Created
March 21, 2023 14:37
-
-
Save Preciousomonze/81c651d6b54aae878561f97674ae24e5 to your computer and use it in GitHub Desktop.
Snippet to log errors in wp functions, also valid for php
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
### | |
function pekky_var_error_log( $object=null ){ | |
ob_start(); // start buffer capture | |
var_dump( $object ); // dump the values | |
$contents = ob_get_contents(); // put the buffer into a variable | |
ob_end_clean(); // end capture | |
error_log( $contents ); // log contents of the result of var_dump( $object ) | |
} | |
############ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment