7. 7
PHP standards before 2009…
Dependency Inversion Principle violation
Hard to change logging library
Apps dependent on the logging library
8. 8
PSR-3: Logger Interface
http://www.php-fig.org/psr/psr-3/
interface LoggerInterface
{
public function emergency($message, array $context = array());
public function alert($message, array $context = array());
public function critical($message, array $context = array());
public function error($message, array $context = array());
public function warning($message, array $context = array());
public function notice($message, array $context = array());
public function info($message, array $context = array());
public function debug($message, array $context = array());
public function log($level, $message, array $context = array());
}
9. 9
PSR-3: Log levels
Alert – immediate action is required
Critical – critical conditions
Emergency – the system is unusable
Error – errors that do not require immediate
attention but should be monitored
Warning – unusual or undesirable
occurrences that are not errors
Notice – normal but significant events
Info – interesting events
Debug – detailed information for debugging purposes