Denne utvidelsen har ikke blitt testet mot noen av de siste 3 hovedutgivelsene av WordPress. Den er kanskje ikke lenger holdt vedlike eller støttet, og den kan ha kompatibilitetsproblemer med nyeste versjoner av WordPress.

WordPress Logger

Beskrivelse

Display log messages from PHP in the browser console in Safari, Firefox (with firebug), and Opera (with the new Dragonfly debugging environment). Essential debugging tool for
plugin and theme developers. You no longer have to use ‘print_r’ statements from PHP to figure out what is going
on in the code, which more often than not, messes up the DOM and HTML layout. Displays complex PHP structures like arrays and objects
in pretty print.

Features

  • Log debug messages directly from themes and plugins.
  • Display log messages in the browser console, without muddying up the browser display.
  • Displays complex structures such as arrays and objects in pretty print.
  • Shows the line number and file from where the message was logged ( you won’t lose track of log statements ).

For more info, comments, and feature requests, visit the plugin homepage.

Credits

Code that forces the wplogger plugin to load first was adapted from the WordPress
FirePHP plugin
developed by Ivan Weiller.

This plugin is based on PEAR Log, the logging framework that is part of the
PHP PEAR library. Current maintainers Jon Parise, Jan Schneider, and Chuck Hagenbuch. PEAR Log is based on code first
developed for the Horde 1.3 framework – original authors Chuck Hagenbuch, and Jon Parise.

Release Notes

0.3 : Added support for Opera ;

0.2.2 : Fixed formatting issues in readme.txt file;

0.2.1 : Added more detail to the readme.txt file;

0.2 : First official public release;

0.1 : First internal release;

Skjermskudd

  • Console log output in the Firefox Browser with the Firebug extension.
  • Console log output in the Safari Browser.
  • Opera Dragonfly Error Console output in the Opera Browser.

Installasjon

Installing from the Admin Panel

  1. Select the Add New subpanel from the Plugins panel.
  2. Type in «wordpress-logger» in the search field and click the Search button.
  3. Identify the «WordPress Logger» from the plugin list and click on its install action.
  4. Click on the Install Now button in the resulting dialog.
  5. Click on the Activate Plugin link.

Installing manually

  1. Verify that you have PHP5, which is required for this plugin.
  2. Upload the whole wordpress-logger folder into the /wp-content/plugins/ directory.
  3. Activate the plugin through the Plugins panel in WordPress.

Requirements

  • Make sure that your theme template has a footer ( index.php should have a get_footer() function call at the end).
  • Turn on the console in your browser:
    • Firefox: The Firebug extension needs to be installed and activated.
    • Safari: Show the Error Console from the Debug/Develop menu. See FAQ section for details on how to enable the Debug menu.

Usage

After activating the plugin, the following PHP function call can log any PHP expression to the console log.

     $wplogger->log( php_expression [, message_type] );

The message_type is optional and can be any one of the following constants:

  • WPLOG_ERR
  • WPLOG_WARNING
  • WPLOG_INFO
  • WPLOG_DEBUG

Examples

Logging from template files – inside the loop to display post IDs.

    <?php $wplogger->log( 'Post ID: '.$post->ID ); ?>

    Output:

    [Information: from line 20 in file index.php] Post ID: 125
    [Information: from line 20 in file index.php] Post ID: 116
    [Information: from line 20 in file index.php] Post ID: 65

Logging from PHP files (e.g. functions.php) ( always a good idea to check if $wplogger is available ). Note the message type set to warning through the second parameter.

    if ($wplogger) $wplogger->log( get_option('active_plugins'), WPLOG_WARNING );

    Output:

    [Warning: from line 55 in file functions.php] array (
          0 => 'wplogger/wplogger.php',
          1 => '12seconds-widget/12seconds-widget.php',
          2 => 'get-the-image/get-the-image.php',
    )

Logging from plugins – inside a plugin function. Note the global statement to get $wplogger into current scope.

    global $wplogger; $wplogger->log( 'No images attached to this post', WPLOG_ERR );

    Output:

    [Error: from line 206 in file get-the-image.php] No images attached to this post

FAQ

How to enable the *Debug* / *Develop* menu in Safari?
How to show the error console in Opera?
  1. Select the Tools > Advanced > Developer Tools menu.
  2. Click on the Error Console tab in the Opera Dragonfly console.

Vurderinger

Det er ingen omtaler av denne utvidelsen.

Bidragsytere og utviklere

“WordPress Logger” er programvare med åpen kildekode. Følgende personer har bidratt til denne utvidelsen.

Bidragsytere