Created
July 15, 2011 18:45
-
-
Save siygle/1085261 to your computer and use it in GitHub Desktop.
Monolog example
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 | |
use Monolog\Logger; | |
use Monolog\Handler\StreamHandler; | |
//create a log channel | |
$log = new Logger('name'); | |
$log->pushHandler(new StreamHandler('/path/to/log', Logger::WARNING)); | |
// add records to the log | |
$log->addWarning('Foo'); | |
$log->addError('Bar'); | |
// autoload Monolog lib | |
function __autoload($class) { | |
$class = str_replace('\\', '/' , $class) . '.php'; | |
require_once($class); | |
} | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment