chiron / logger
Minimalist PSR3 Logger (mostly extracted from symfony)
Fund package maintenance!
ncou
0.2.4
2021-11-27 10:41 UTC
Requires
- php: ^8.0|^8.1
- chiron/core: ^1.0
- psr/log: ^1.0
Requires (Dev)
- chiron/coding-standard: ^3.0
- phpstan/phpstan: ^0.12
- phpstan/phpstan-phpunit: ^0.12
- phpunit/phpunit: ^9.5
README
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