lessname/logger

This package is abandoned and no longer maintained. No replacement package was suggested.

Log the info you want

1.1.0 2020-01-15 20:21 UTC

This package is auto-updated.

Last update: 2021-11-27 13:29:47 UTC


README

Solve your errors quicker.

License

Mozilla Public License 2.0

Example

Add the LoggerAware trait to your classes to add the logger to your classes

<?php
use LessLogger\{LoggerAware, LogLevel};

class Baz {
    use LoggerAware;
    
    public function foo()
    {
        $this->log(LogLevel::DEBUG, 'Bar');
    }
}

Usage

In the LessLogger\LogLevel we have defined a couple of standard of default log levels which you could use. However you are free to introduce your own levels.

With the LessLogger\LoggerAware you add the logger as a requirement to the class.

If you don't want to actual log anything yet, you can use the LessLogger\NullLogger. The advantage of requiring a logger is to prevent the checks every time if a logger is available.

Next you pick/make your own implementation of the Logger and you are set to go.