logger / errorhandling
Errorhandling extension for PSR-3 compatible loggers
Installs: 1 300
Dependents: 0
Suggesters: 0
Security: 0
Stars: 0
Watchers: 2
Forks: 1
Open Issues: 0
Requires
- php: >= 7.0
- logger/essentials: *
Requires (Dev)
- phpunit/phpunit: ^8.0
Suggests
- logger/essentials: Advanced logging component library
README
Errorhandling extension for PSR-3 compatible loggers
Why should I care?
CoreErrorHandlers
helps you getting every type of problem in your logging-channels.
How does it work?
CoreErrorHandlers
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:
use Logger\CoreErrorHandlers; // ... CoreErrorHandlers::enableExceptionsForErrors(); CoreErrorHandlers::registerAssertionHandler($logger, LogLevel::DEBUG); CoreErrorHandlers::registerExceptionHandler($logger); CoreErrorHandlers::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.