bitexpert / slf4psrlog
Simple Logging Facade for Loggers implementing PSR-3 logging interface.
Installs: 14 084
Dependents: 7
Suggesters: 0
Security: 0
Stars: 6
Watchers: 13
Forks: 2
Open Issues: 0
Requires
- psr/log: ^1.0
Requires (Dev)
- phpdocumentor/phpdocumentor: ^2.8.0
- phpmd/phpmd: ^2.2.0
- phpunit/php-code-coverage: ^2.1.0
- phpunit/phpunit: ^4.7.0
- squizlabs/php_codesniffer: ^2.3
Provides
- psr/log-implementation: 1.0.0
This package is auto-updated.
Last update: 2024-11-06 10:20:19 UTC
README
The Simple Logging Facade for PSR-3 loggers serves as a simple facade or abstraction for the various logging frameworks implementing the PSR-3 logging standard. To achieve true interoperability, your own code should not depend on a specific library implementing the PSR-3 logging standard.
Installation
The preferred way of installing bitexpert/slf4psrlog
is through Composer. Simply add bitexpert/slf4psrlog
as a
dependency:
composer.phar require bitexpert/slf4psrlog
Example
Configure a callable to return a logger instance:
\bitExpert\Slf4PsrLog\LoggerFactory::registerFactoryCallback(function($channel) { // return configured PSR-3 logger instance });
In your classes create a logger instance by calling:
$logger = \bitExpert\Slf4PsrLog\LoggerFactory::getLogger(__CLASS__);
The \bitExpert\Slf4PsrLog\LoggerFactory will delegate the call to the callback function which needs to return an instance of a PSR-3 logger.
License
slf4psrlog is released under the Apache 2.0 license.