Skip to content

Instantly share code, notes, and snippets.

@joshuadavidnelson
Created January 31, 2015 16:17
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save joshuadavidnelson/b315bcd407b12cdb052f to your computer and use it in GitHub Desktop.
Save joshuadavidnelson/b315bcd407b12cdb052f to your computer and use it in GitHub Desktop.
Log errors in WordPress
<?php
/**
* Log any errors for debugging.
*
* @global WP_DEBUG
* @uses error_log
* @var string|array $message the error message (a string or array)
*/
if( !function_exists( 'jdn_log_me' ) ) {
function jdn_log_me( $message ) {
if ( WP_DEBUG === true ) {
if ( is_array( $message ) || is_object( $message ) ) {
error_log( 'Custom Plugin Error: ' . print_r( $message, true ) );
} else {
error_log( 'Custom Plugin Error: ' . $message );
}
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment