Lightning Talks - Monolog


Jordi Boggiano   @seldaek

http://nelm.io/

Why?

"Making logging fun" - Logbook

Simplicity

4 levels: DEBUG, INFO, WARNING, ERROR

API

$logger->addDebug('message')
$logger->addInfo('message')
$logger->addWarning('message')
$logger->addError('message')
            

FingersCrossedHandler

use Monolog\Logger;
use Monolog\Handler\FileHandler;
use Monolog\Handler\FingersCrossedHandler;

// create a log channel
$log = new Logger('db');

// create a handler
$handler = new FileHandler('path/to/your.log', Logger::DEBUG);
$fchandler = new FingersCrossedHandler($handler, Logger::WARNING);
$log->pushHandler($handler);

// add records to the log
$log->addDebug('Verbose information');
$log->addError('Bar');
            

Channels

$routeLog = new Logger('routing');
$dbLog = new Logger('db');
            

Upcoming

Handlers: FirePHP, syslog, mail, jira, ..?

References & Links

Thank you.

Questions?

Slides up at slides.seld.be

Feedback please on
http://joind.in/2933