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

farmani/yii2-resque v1.2.2
ortnit/logger dev-master

Class usage:

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