Last active
April 5, 2017 13:19
-
-
Save yfix/0bb1da3b49bd66cfbaba7e9047379ae3 to your computer and use it in GitHub Desktop.
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 | |
/** | |
* @example: _debug_log($_POST) | |
*/ | |
function _debug_log() { | |
$text = func_get_args(); | |
if (is_array($text) || is_object($text)) { | |
$text = var_export($text, 1); | |
} | |
$dir = rtrim(defined('LOGS_DIR') ? LOGS_DIR : __DIR__, '/').'/'; | |
!file_exists($dir) && mkdir($dir, 0755, true); | |
$data = [date('Y-m-d H:i:s').' | ', $text]; | |
return file_put_contents($dir.'debug.log', implode($data). PHP_EOL, FILE_APPEND); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment