Skip to content

Instantly share code, notes, and snippets.

@sbrin
Created November 24, 2014 16:28
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save sbrin/e0131f4ce651de1e13fd to your computer and use it in GitHub Desktop.
Save sbrin/e0131f4ce651de1e13fd to your computer and use it in GitHub Desktop.
simple php logging
function saveLog( $data )
{
$logname = date("Ymd") . ".log.txt";
$handle = fopen($logname, "a+");
if ($handle !== false) {
fwrite($handle, $data . PHP_EOL);
fclose($handle);
} else {
throw new Exception("saveLog fopen error");
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment