Skip to content

Instantly share code, notes, and snippets.

@malteo
Created October 5, 2011 13:12
Show Gist options
  • Save malteo/1264387 to your computer and use it in GitHub Desktop.
Save malteo/1264387 to your computer and use it in GitHub Desktop.
How to use Monolog in any PHP file
<?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.');
@yoX64
Copy link

yoX64 commented Jul 31, 2018

Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment