Created
August 23, 2023 09:49
-
-
Save scossar/231264166bd1e6633fea08d907867651 to your computer and use it in GitHub Desktop.
A tiny WordPress plugin that writes a comma separated list of arguments to a debug.log file
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 | |
/** | |
* Plugin Name: log error | |
* Version: 0.1 | |
* Author: scossar | |
*/ | |
function write_log( ...$log_items ) { | |
if ( true === WP_DEBUG ) { | |
foreach ( $log_items as $log_item ) { | |
if ( is_array( $log_item ) || is_object( $log_item ) ) { | |
error_log( print_r( $log_item, true ) ); | |
} else { | |
error_log( $log_item ); | |
} | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment