chiron/logger

Minimalist PSR3 Logger (mostly extracted from symfony)

Fund package maintenance!
ncou

0.2.4 2021-11-27 10:41 UTC

This package is auto-updated.

Last update: 2024-11-27 17:10:43 UTC


README

Build Status Coverage Status CodeCov

Total Downloads Monthly Downloads

StyleCI

Example :

<?php
// you can define minimal login level (ex : ERROR) if you add a second parameter, by default all the levels are logged
$logger = new Chiron\Logger('./' . 'logger_'. date('Y-m-d') .'.log');
$logger->log('error',  'Example error text' );

//Multilines + replace value beetween "{}"
$logger->log('error',  'Line 1 : {TXT}', array('TXT' => null) ); // empty
$logger->log('error',  'Line 2 : {TXT}', array('TXT' => 'toto') ); // string
$logger->log('error',  'Line 3 : {TXT}', array('TXT' => 1234) ); // integer
$logger->log('error',  'Line 4 : {TXT}', array('TXT' => date(\DateTime::RFC3339) ) ); // object date

$logger->info('info text !');
$logger->notice('notice text !');

$logger->warning('Warning text : {TXT}', array('TXT' => 'Hector' ) );

Minimalist PSR3 Logger based on : https://github.com/symfony/symfony/blob/master/src/Symfony/Component/HttpKernel/Log/Logger.php