Created
March 28, 2025 03:56
-
-
Save autocircled/f5e2f373acbdc3e3a280311f7a4e5a90 to your computer and use it in GitHub Desktop.
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( ...$data ) { | |
if ( true === WP_DEBUG ) { | |
$backtrace = debug_backtrace(); | |
$backtrace = array_shift( $backtrace ); | |
$output['backtrace'] = $backtrace['file'] . ':' . $backtrace['line']; | |
foreach ( $data as $key => $value ) { | |
$output['data' . ($key + 1)] = $value; | |
} | |
error_log( print_r( $output, true ) ); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment