Last active
August 29, 2015 14:12
-
-
Save Braunson/42d2b507a160c5bb38f6 to your computer and use it in GitHub Desktop.
Quick write to file with date/time, very crude.
This file contains hidden or 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 logToFile($msg) { | |
$filename = 'logfile.log'; | |
if(is_array($msg)){ | |
file_put_contents($filename, print_r($msg, true), FILE_APPEND); | |
} else { | |
$fd = fopen($filename, "a"); | |
$str = "[" . date("Y/m/d h:i:s", mktime()) . "] " . $msg; | |
fwrite($fd, $str . "\n"); | |
fclose($fd); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment