PHP code example of jeyroik / extas-loggers-light

1. Go to this page and download the library: Download jeyroik/extas-loggers-light library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

jeyroik / extas-loggers-light example snippets



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');