Created
December 31, 2017 00:39
-
-
Save nkostic/03d8fc12cb093f1b1a21fd4afc26be47 to your computer and use it in GitHub Desktop.
tail -f debug.log to read the log from terminal
This file contains 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 line debug | |
*/ | |
function debug_log($data) { | |
$filename = realpath(__DIR__ . './debug.log'); | |
if (!file_exists($filename) || !is_writable($filename)) { | |
return; | |
} | |
file_put_contents($filename, sprintf("[%s] %s \n", | |
date('m-d-Y h:i:s', time()), | |
trim(var_export($data, true), "'") | |
), FILE_APPEND); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment