Created
January 9, 2014 20:12
-
-
Save dejanmarkovic/8341118 to your computer and use it in GitHub Desktop.
WordPress Custom debug.log function
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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