duncan3dc / logger-aware-trait
A PSR-3 trait allowing any class to easily add logger support
Installs: 30 417
Dependents: 2
Suggesters: 0
Security: 0
Stars: 1
Watchers: 2
Forks: 1
Open Issues: 0
Requires
- php: ^7.3 || ^8.0
- psr/log: ^1.1.3
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.6.2
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 catch me on Twitter
duncan3dc/logger-aware-trait for enterprise
Available as part of the Tidelift Subscription
The maintainers of duncan3dc/logger-aware-trait and thousands of other packages are working with Tidelift to deliver commercial support and maintenance for the open source dependencies you use to build your applications. Save time, reduce risk, and improve code health, while paying the maintainers of the exact dependencies you use. Learn more.