Skip to content

Instantly share code, notes, and snippets.

@KB1RMA
Created August 14, 2014 14:51
Show Gist options
  • Save KB1RMA/f11021d3894eebbf8c04 to your computer and use it in GitHub Desktop.
Save KB1RMA/f11021d3894eebbf8c04 to your computer and use it in GitHub Desktop.
Provides a useful function for debugging in Wordpress that gets sent to wp-content/debug.log
<?php
// Useage looks like: trace_log($awesomeVar);
if (!function_exists('trace_log')) {
function trace_log ($log) {
if (true === WP_DEBUG) {
if (is_array($log) || is_object($log)) {
error_log(print_r($log, true));
} else {
error_log($log);
}
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment