Description

Simple Logger Powerful PSR-3 logging so easy it's simple!

Implements PHP Standard Recommendation interface: PSR-3 \Psr\Log\LoggerInterface

Log the following severities: debug, info, notice, warning, error, critical, alert, emergency. Log format: YYYY-mm-dd HH:ii:ss.uuuuuu [loglevel] [channel] [pid:##] Log message content {"Optional":"JSON Contextual Support Data"} {"Optional":"Exception Data"}

Standard usage - default options: $logger = new SimpleLog\Logger('logfile.log', 'channelname'); $logger->info('Normal informational event happened.'); $logger->error('Something bad happened.', ['key1' => 'value that gives context', 'key2' => 'some more context', 'exception' => $e]);

Optional constructor option: Set default lowest log level (Example error and above): $logger = new SimpleLog\Logger('logfile.log', 'channelname', \Psr\Log\LogLevel::ERROR); $logger->error('This will get logged'); $logger->info('This is below the minimum log level and will not get logged');

To log an exception, set as data context array key 'exception' $logger->error('Something exceptional happened.', ['exception' => $e]);

To set output to standard out (STDOUT) as well as a log file: $logger->setOutput(true);

To change the channel after construction: $logger->setChannel('newname')

Type hierarchy

psr/log 1.1.4
View more packages
cyan.tseng/logger dev-master
graef685/log 4.0.0 1.1.4
imdbphp/imdbphp v4.1.1
instituteweb/typo3-cms 6.2.31
integer-net/solr-base 1.0.4
mrcnpdlk/imdbphp v4.1.1
ortnit/logger dev-master
piro/imdbphp v4.1.1
psr-php7/log dev-master 1.0.0
rkr/amazon-pay-sdk-php 2.x-dev
struggle-for-php/sfp-psalm-psr-log-plugin 0.2.0

Class usage:

This class is not referred by any other class/interface/traits in packagist packages.