Skip to content

Instantly share code, notes, and snippets.

@tylerdigital
Created September 4, 2015 17:48
Show Gist options
  • Save tylerdigital/a02d200bbc93d60b10e6 to your computer and use it in GitHub Desktop.
Save tylerdigital/a02d200bbc93d60b10e6 to your computer and use it in GitHub Desktop.
function td_debug_log($sMsg = NULL) {
if (!is_string($sMsg)) $sMsg = print_r($sMsg, true);
$sFile = dirname(__FILE__) . '/~log.txt';
$fh = fopen($sFile, 'a+');
if ($fh !== FALSE)
{
if ($sMsg === NULL)
fwrite($fh, date("\r\nY-m-d H:I:s:\r\n"));
else
fwrite($fh, date('Y-m-d H:i:s - ') . $sMsg . "\r\n");
fclose($fh);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment