corephp/log

Easy log system to log information by STDOUT and logfile

0.2.1 2018-02-21 18:55 UTC

This package is auto-updated.

Last update: 2024-10-27 07:39:41 UTC


README

An easy log system for php webapps

Basic use

use CorePHP\Log\Logger;
use CorePHP\Log\Handlers\FileHandler;
use CorePHP\Log\Formatters\WebFormatter;
use CorePHP\Log\Handlers\StdoutHandler;

$logger = new Logger('TEST');
$formatter = new WebFormatter();

$handler = new FileHandler(__DIR__ . '/logger.log');
$handler1 = new StdoutHandler(true);
$handler->setFormatt($formatter);
$handler1->setFormatt($formatter);

$logger->addHandler($handler);
$logger->addHandler($handler1);

$logger->error('Mensaje random');