Created
November 24, 2014 16:28
-
-
Save sbrin/e0131f4ce651de1e13fd to your computer and use it in GitHub Desktop.
simple php logging
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
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