Last active
August 14, 2019 11:51
-
-
Save madcatgith/46c4a38f54ae7cd5109736d7542672ab to your computer and use it in GitHub Desktop.
Log to file
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 logToFile($data, $debug=true){ | |
if($debug){ | |
if(is_array($data) || is_object($data)){ | |
$data=print_r($data,true); | |
} | |
else{ | |
$data=PHP_EOL.$data.PHP_EOL; | |
} | |
file_put_contents($_SERVER["DOCUMENT_ROOT"].'/custom_log.log', $data, FILE_APPEND); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment