duncan3dc / logger-aware-trait
A PSR-3 trait allowing any class to easily add logger support
Requires
- php: ^8.0
- psr/log: ^2.0 || ^3.0
Requires (Dev)
- duncan3dc/object-intruder: ^0.3 || ^1.0
- maglnet/composer-require-checker: ^2.0 || ^3.0
- mockery/mockery: ^1.2
- phpstan/phpstan: ^1.5.0
- phpunit/phpunit: ^9.5
- squizlabs/php_codesniffer: ^3.13.5
Suggests
None
Provides
None
Conflicts
None
Replaces
None
README
A PSR-3 trait allowing any class to easily add logger support
Installing
The recommended method of installing this library is via Composer.
Run the following command from your project root:
$ composer require duncan3dc/logger-aware-trait
Setup
Simply apply the trait to your classes:
use duncan3dc\Log\LoggerAwareTrait; class MyClass { use LoggerAwareTrait; }
Now the class will have a getLogger() method that you can safely call.
If a logger has been injected using setLogger() then that logger will be provided, otherwise a NullLogger will be used instead.
Changelog
A Changelog has been available since the beginning of time
Where to get help
Found a bug? Got a question? Just not sure how something works?
Please create an issue and I'll do my best to help out.
Alternatively you can connect with me on LinkedIn