Skip to content

Instantly share code, notes, and snippets.

@theMikeD
Last active August 29, 2015 14:12
Show Gist options
  • Save theMikeD/589f0065f7d9785c4f20 to your computer and use it in GitHub Desktop.
Save theMikeD/589f0065f7d9785c4f20 to your computer and use it in GitHub Desktop.
More flexible replacement for error_log()
<?php
//----------------------------------------------------------------------------------------
// print to the log, either a variable, object or array
function md_log ( $o ){
$callers=debug_backtrace();
error_log ($callers[1]['function']);
if ( is_array( $o ) || is_object( $o ) ) {
error_log(print_r( $o, true));
} else {
error_log( $o );
}
}
?>
@theMikeD
Copy link
Author

Can't get the language formatting to stick, so you're stuck with txt.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment