Skip to content

Instantly share code, notes, and snippets.

@dejanmarkovic
Created January 9, 2014 20:12
Show Gist options
  • Save dejanmarkovic/8341118 to your computer and use it in GitHub Desktop.
Save dejanmarkovic/8341118 to your computer and use it in GitHub Desktop.
WordPress Custom debug.log function
if (!function_exists('write_log')) {
function write_log ( $log ) {
if ( true === WP_DEBUG ) {
if ( is_array( $log ) || is_object( $log ) ) {
error_log( print_r( $log, true ) );
} else {
error_log( $log );
}
}
}
}
//calling function
write_log('THIS IS THE START OF MY CUSTOM DEBUG');
write_log($whatever_you_want_to_log);
Source:http://www.stumiller.me/sending-output-to-the-wordpress-debug-log/
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment