Created
February 26, 2018 03:06
-
-
Save CatEntangler/18295a6578c09223c8053011e82db221 to your computer and use it in GitHub Desktop.
Log anything to error log with pretty printing
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('_log') ) { | |
/** | |
* @description Takes any message and sends it to the error_log. Due to how php's serialize works (will add binary characters) and that error_log will truncate when it hits a binary character a str_replace is used. | |
* | |
* @param $message mixed anything you want to print out | |
*/ | |
function _log( $message ) { | |
error_log( str_replace( "\0", "[NULL]", print_r( $message, TRUE ) ) ); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment