logger/errorhandling

Errorhandling extension for PSR-3 compatible loggers

0.1.9.1 2016-05-19 20:01 UTC

README

Scrutinizer Code Quality Build Status Latest Stable Version License

Errorhandling extension for PSR-3 compatible loggers

Why should I care?

ErrorHandling helps you getting every type of problem in your logging-channels.

How does it work?

ErrorHandling uses most of PHP's capabilities to capture notices, warnings, errors, exceptions and even fatal errors in most situations and redirect them to user-defined PSR-3 compatible logging channels.

Typically you would end up having something like this:

$coreHandlers = new CoreErrorHandlers();
$coreHandlers->enableExceptionsForErrors();
$coreHandlers->registerAssertionHandler($logger, LogLevel::DEBUG);
$coreHandlers->registerExceptionHandler($logger);
$coreHandlers->registerFatalErrorHandler($logger);

This will register trigger-callback-functions for asserts, exceptions and fatal errors. It also registers exception-handlers for every notice, warning and error.

Note: You need to run the registration-process on every run. Yes, I think you already got it, but just in case: Any problems only get caught if the registration was already made at the time the problem occurs.