Created
October 5, 2011 13:12
-
-
Save malteo/1264387 to your computer and use it in GitHub Desktop.
How to use Monolog in any PHP file
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
<?php | |
spl_autoload_register(function ($class) { | |
$file = $__DIR__.'/relative/path/to/Monolog/src/'.strtr($class, '\\', '/').'.php'; | |
if (file_exists($file)) { | |
require $file; | |
return true; | |
} | |
}); | |
use Monolog\Logger; | |
use Monolog\Handler\StreamHandler; | |
$log = new Logger('name'); | |
$log->pushHandler(new StreamHandler(__DIR__.'/path/to/your.log', Logger::DEBUG)); | |
$log->addInfo('Do your magic here.'); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Thanks!