Last active
May 7, 2019 20:53
-
-
Save ryantxr/fb2b2fa9fa63b34a1bd9 to your computer and use it in GitHub Desktop.
Super simple logger for php. For those times when you are just throwing something together for a quick hack.
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
<?php | |
class Logger { | |
static function debug($msg) { | |
$file = dirname(__FILE__) . "/debug.log"; | |
$output = strftime('%Y-%m-%d %T ') . ":" . $msg . "\n"; | |
file_put_contents($file, $output, FILE_APPEND); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Here's how to use it:
require_once 'Logger.php';
Logger::debug("Here is my message");
In debug.log, you will see the output:
2016-11-23 22:12:45 Here is my message