Chau Pham
PSR-3 is a proposed standard describing a common logging interface for PHP frameworks.
The logger interface defined by PSR-3 allows us to write reusable code that isn’t dependent on any particular logging implementation.
The LoggerInterface exposes 8 methods to write logs
Helper classes and interfaces
Usage
<?php
use Monolog\Logger;
use Monolog\Handler\StreamHandler;
// create a log channel
$log = new Logger('name');
$log->pushHandler(new StreamHandler('path/to/your.log', Logger::WARNING));
// add records to the log
$log->addWarning('Foo');
$log->addError('Bar');
Log Levels
DEBUG (100)
INFO (200)
NOTICE (250)
WARNING (300)
ERROR (400)
CRITICAL (500)
ALERT (550)
EMERGENCY (600)
Handlers
Log to files and syslog
Handlers
Send alerts and emails
Handlers
Handlers
Handlers
Handlers
Handlers