Created
July 2, 2018 14:06
-
-
Save Inzman/e6b52081bcf612182864b3b7b930724d to your computer and use it in GitHub Desktop.
Write to daily log in Wordpress
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
| if(!function_exists('write_log')){ | |
| function write_log($log){ | |
| //if(true === WP_DEBUG){ | |
| $log_file_name = WP_CONTENT_DIR.'/logs/'.date('Y-m-d').'.log'; | |
| if(is_writable($log_file_name)){ | |
| if(is_array($log) || is_object($log)){ | |
| error_log(print_r($log, true)."\n", 3, $log_file_name); | |
| } else { | |
| error_log($log."\n", 3, $log_file_name); | |
| } | |
| } | |
| //} | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment