The Logger
class provides all of the basic PSR-3 functionality guaranteed by the
Psr\Log\AbstractLogger
abstract class. Additionally it provides a mechanism to attach one or
more appenders that implement the Stoic\Log\AppenderBase
abstract class and are used
during log output.
This class, by implementing the Psr\Log\AbstractLogger
abstract class, guarantees the
following methods:
public void emergency(string $message, array $context = array()) System is unusable public void alert(string $message, array $context = array()) Action must be taken immediately public void critical(string $message, array $context = array()) Critical conditions public void error(string $message, array $context = array()) Runtime errors that do not require immediate action but should typically be logged and monitored public void warning(string $message, array $context = array()) Exceptional occurrences that are not errors public void notice(string $message, array $context = array()) Normal but significant events public void info(string $message, array $context = array()) Interesting events public void debug(string $message, array $context = array()) Detailed debug information
private Stoic\Chain\ChainHelper $appenders Internal instance of a ChainHelper to manage appenders for the object private Message[] $messages Collection of log messages for the object protected static string[] $levels Numerically indexed collection of log levels for 'minimum level' comparisons
public Logger __construct(null|string $minimumLevel = null, null|AppenderBase[] $appenders = null) Constructor with optional arguments to set minimum log level and provide collection of AppenderBase appenders to add immediately public void addAppender(AppenderBase $appender) Attempts to add (link) an appender to the internal ChainHelper for output appenders protected string interpolate(string $message, array $context) Interpolates context values into a log message public void log(string $level, string $message, array $context = array()) Stores an arbitrary message & log level into the internal collection of Message objects protected boolean meetsMinimumLevel(string $level) Determines whether or not the given level is at least as 'high' as the object's minimum level public void output() Triggers a dump of all stored log messages to any configured appenders; Clears internal collection after processing
For examples, please see the 'Logger' section of the Examples page.
Continue to read about appenders, or visit the Table of Contents.