Created
September 3, 2018 17:52
-
-
Save andrija-naglic/dae653a2b0fb7da652fbf19aa37697af to your computer and use it in GitHub Desktop.
Short WP function that is used to output custom data to debug.log
This file contains hidden or 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
<?php | |
function write_log ( $log, $text = "write_log: ", $delete = false ) { | |
if( $delete ){ | |
unlink( WP_CONTENT_DIR . '/debug.log' ); | |
} | |
if ( is_array( $log ) || is_object( $log ) ) { | |
error_log( $text . PHP_EOL . print_r( $log, true ) ); | |
} else { | |
error_log( $text . PHP_EOL . $log ); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment