duncan3dc/logger-aware-trait

A PSR-3 trait allowing any class to easily add logger support

1.0.0 2022-04-14 09:43 UTC

This package is auto-updated.

Last update: 2024-10-14 14:58:01 UTC


README

A PSR-3 trait allowing any class to easily add logger support

release build coverage

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.