bytic / logger
There is no license information available for the latest version (2.0.1) of this package.
Logger component for bytic
2.0.1
2026-04-13 16:30 UTC
Requires
- php: ^8.3
- bytic/config: ^0.9|^1.0|^2.0
- bytic/container: ^0.9|^1.0|^2.0
- bytic/debug: ^0.9|^1.0|^2.0
- bytic/newrelic: ^1.0
- bytic/utility: ^1.0
- monolog/monolog: ^3.0
- symfony/deprecation-contracts: ^3.0
Requires (Dev)
- bytic/application: ^0.9|^1.0|^2.0
- bytic/phpqatools: ^1.0
- phpunit/phpunit: ^12.0
README
A PSR-3 logger component for bytic applications, built on top of Monolog.
Requires PHP 8.3+
Installation
composer require bytic/logger
Usage
Register the LoggerServiceProvider in your application bootstrap:
$container->addServiceProvider(new \Nip\Logger\LoggerServiceProvider());
The provider registers log and Psr\Log\LoggerInterface into the container.
Error Level Routing
PHP native errors (warnings, notices, deprecations) are converted to PSR-3 log
entries by the bytic/debug ErrorHandler. Version 2.x uses
\Nip\Logger\ErrorHandler\PhpErrorLevelMapper to map each E_* constant to
the appropriate PSR-3 level:
| PHP Error Type | PSR-3 Level |
|---|---|
E_WARNING |
warning |
E_USER_WARNING |
warning |
E_CORE_WARNING |
warning |
E_COMPILE_WARNING |
warning |
E_NOTICE |
notice |
E_USER_NOTICE |
notice |
E_DEPRECATED |
info |
E_USER_DEPRECATED |
info |
E_ERROR |
error |
E_USER_ERROR |
error |
E_RECOVERABLE_ERROR |
error |
E_PARSE |
critical |
E_CORE_ERROR |
critical |
E_COMPILE_ERROR |
critical |
E_STRICT |
debug |
This replaces the previous behaviour where warnings and notices were incorrectly logged at ERROR level.
Migration Notes
When upgrading from 1.x:
Logger::getFormatter()andLogger::format()have been removed. Message formatting is now handled exclusively by Monolog'sLineFormatter.- Inject
Psr\Log\LoggerInterfacevia constructor injection instead of$container->get('log')where possible.