Skip to content

Instantly share code, notes, and snippets.

@5iDS
Created July 22, 2013 13:33
Show Gist options
  • Save 5iDS/6053837 to your computer and use it in GitHub Desktop.
Save 5iDS/6053837 to your computer and use it in GitHub Desktop.
Centralize all log calls to use this function. will call a print_r on arrays and objects passed to the function for simple debugging.
if(!function_exists('_log')){
function _log( $message ) {
if( WP_DEBUG === true ){
if( is_array( $message ) || is_object( $message ) ){
error_log( print_r( $message, true ) );
} else {
error_log( $message );
}
}
}
}
@5iDS
Copy link
Author

5iDS commented Jul 22, 2013

wrapper function to handle WP Dev. logging, no reason to test if WP_DEBUG has been defined because as soon as wp-settings.php is processed, WP_DEBUG will be defined, even if it wasn’t already defined in wp-config.php.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment