Create a gist now

Instantly share code, notes, and snippets.

Embed
What would you like to do?
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