Debugger

plugin banner

Code for debugging code

Author:Modern Tribe, Inc. (profile at wordpress.org)
WordPress version required:3.0
WordPress version tested:3.6
Plugin version:1.4
Added to WordPress repository:15-02-2013
Last updated:05-05-2013
Warning! This plugin has not been updated in over 2 years. It may no longer be maintained or supported and may have compatibility issues when used with more recent versions of WordPress.
Rating, %:90
Rated by:2
Plugin URI:
Total downloads:3 679
Active installs:10+
plugin download
Click to start download

You can use this plugin to manually log data or to capture logging on WordPress actions. You can capture load time, memory, backrace, data dumps, urls, and server IPs.

This is designed to either be managed using wp-config.php and logging OR using the admin and debugbar plugin ( http://wordpress.org/extend/plugins/debug-bar/ ). Most of the following documentation applies equally to the settings panel or the wp-config.php vars. Either one works fine. The only exception is the DEBUG_LOG configuration which is only supported as a wp-config var.

Firstly, you can manually log things using the following function:

do_action( 'log', $message, $group, $data );

The $group allows you to selectively output logging based on groups of log messages. The $message is the string you want to see in the log. $data is an optional parameter for the data that you want to display in the log (objects, arrays, or any other sort of data really).

To render messages to the log, you must configure wp-config.php as follows:

Run debug on only these groups. Use 'ALL' to debug everything. The group 'ACTIONS' is reserved for WordPress actions.

define( 'DEBUG_GROUPS', 'ACTIONS,default,myspecialgroup' );

Display these outputs in the log for each log message.

define( 'DEBUG_PARAMS', 'time,timedelta,memory,memorydelta,data,backtrace,url,server' );

WordPress actions that you wish to log.

define( 'DEBUG_ACTIONS', 'wp_head,switch_theme,wp_footer' );

Optional restriction by URL (useful on MU installs).

define( 'DEBUG_URLS', 'myurl.com' );

Minimum time in milliseconds required to register a log entry as being slow. Default 0 for no minumum.

define( 'DEBUG_MIN_TIME', 500 );

Minimum memory in killobytes required to register a log entry as being heavy. Default 0 for no minumum.

define( 'DEBUG_MIN_MEM', 1024 );

Path to log file or set to TRUE to use php error log. Default FALSE for no logging.

define( 'DEBUG_LOG', '/path/to/writable/log/file' );

or

define( 'DEBUG_LOG', TRUE );

Todo

  • Add variable for sample rate so that this could run randomly on production installs
  • Admin panel per site
  • Admin panel globally
  • WordPress error logging
  • Mysql query logging
  • WP_Error integration
  • Alerts ex: if this takes more than this much memory then log it...

Screenshots
ChangeLog