Skip to content

Instantly share code, notes, and snippets.

@nkostic
Created December 31, 2017 00:39
Show Gist options
  • Save nkostic/03d8fc12cb093f1b1a21fd4afc26be47 to your computer and use it in GitHub Desktop.
Save nkostic/03d8fc12cb093f1b1a21fd4afc26be47 to your computer and use it in GitHub Desktop.
tail -f debug.log to read the log from terminal
/**
* 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