jeyroik/extas-loggers-light

There is no license information available for the latest version (0.1.0) of this package.

Extas light wrapper for logging

0.1.0 2023-04-13 10:38 UTC

This package is auto-updated.

Last update: 2024-11-13 14:10:45 UTC


README

PHP Composer codecov.io Latest Stable Version Total Downloads Dependents

extas-loggers-light

Light logger package

usage

use extas\interfaces\loggers\ICanLog;
use extas\components\loggers\TCanLog;
use extas\components\loggers\EMode;

use Monolog\Handler\StreamHandler;
use Monolog\Level;
use Monolog\Logger;

class My implements ICanLog
{
    use TCanLog;

    public function __construct()
    {
        $logger = new Logger('test');
        $logger->pushHandler(new StreamHandler('/some/path.log', Level::Debug));
        $this->setLogger($logger);
    }
}

$my = new My();
$my->setMode(EMode::DEBUG);
$my->log('message', ['some' => 'context'], Level::Debug);
// or just $my->log('message');