78    const EMERGENCY = 600;
 
   95    protected static $levels = array(
 
   98        self::NOTICE    => 
'NOTICE',
 
   99        self::WARNING   => 
'WARNING',
 
  100        self::ERROR     => 
'ERROR',
 
  101        self::CRITICAL  => 
'CRITICAL',
 
  102        self::ALERT     => 
'ALERT',
 
  103        self::EMERGENCY => 
'EMERGENCY',
 
  135    protected $microsecondTimestamps = 
true;
 
  150        $this->setHandlers($handlers);
 
  151        $this->processors = $processors;
 
  183        array_unshift($this->handlers, 
$handler);
 
  195        if (!$this->handlers) {
 
  196            throw new \LogicException(
'You tried to pop from an empty handler stack.');
 
  199        return array_shift($this->handlers);
 
  212        $this->handlers = array();
 
  213        foreach (array_reverse($handlers) as 
$handler) {
 
  225        return $this->handlers;
 
  236        if (!is_callable($callback)) {
 
  237            throw new \InvalidArgumentException(
'Processors must be valid callables (callback or object with an __invoke method), '.var_export($callback, 
true).
' given');
 
  239        array_unshift($this->processors, $callback);
 
  251        if (!$this->processors) {
 
  252            throw new \LogicException(
'You tried to pop from an empty processor stack.');
 
  255        return array_shift($this->processors);
 
  263        return $this->processors;
 
  281        $this->microsecondTimestamps = (bool) $micro;
 
  294        if (!$this->handlers) {
 
  298        $levelName = static::getLevelName($level);
 
  302        reset($this->handlers);
 
  303        while (
$handler = current($this->handlers)) {
 
  304            if (
$handler->isHandling(array(
'level' => $level))) {
 
  305                $handlerKey = key($this->handlers);
 
  309            next($this->handlers);
 
  312        if (
null === $handlerKey) {
 
  316        if (!static::$timezone) {
 
  317            static::$timezone = new \DateTimeZone(date_default_timezone_get() ?: 
'UTC');
 
  321        if ($this->microsecondTimestamps && PHP_VERSION_ID < 70100) {
 
  322            $ts = \DateTime::createFromFormat(
'U.u', sprintf(
'%.6F', microtime(
true)), static::$timezone);
 
  324            $ts = new \DateTime(
null, static::$timezone);
 
  326        $ts->setTimezone(static::$timezone);
 
  332            'level_name' => $levelName,
 
  333            'channel' => $this->name,
 
  339            foreach ($this->processors as $processor) {
 
  340                $record = call_user_func($processor, $record);
 
  343            while (
$handler = current($this->handlers)) {
 
  344                if (
true === 
$handler->handle($record)) {
 
  348                next($this->handlers);
 
  350        } 
catch (Exception $e) {
 
  351            $this->handleException($e, $record);
 
  369        foreach ($this->handlers as 
$handler) {
 
  370            if (method_exists(
$handler, 
'close')) {
 
  388        foreach ($this->handlers as 
$handler) {
 
  394        foreach ($this->processors as $processor) {
 
  504        return array_flip(static::$levels);
 
  515        if (!isset(static::$levels[$level])) {
 
  516            throw new InvalidArgumentException(
'Level "'.$level.
'" is not defined, use one of: '.implode(
', ', array_keys(static::$levels)));
 
  519        return static::$levels[$level];
 
  530        if (is_string($level) && defined(__CLASS__.
'::'.strtoupper($level))) {
 
  531            return constant(__CLASS__.
'::'.strtoupper($level));
 
  549        foreach ($this->handlers as 
$handler) {
 
  550            if (
$handler->isHandling($record)) {
 
  566        if (!is_callable($callback)) {
 
  567            throw new \InvalidArgumentException(
'Exception handler must be valid callable (callback or object with an __invoke method), '.var_export($callback, 
true).
' given');
 
  569        $this->exceptionHandler = $callback;
 
  579        return $this->exceptionHandler;
 
  588        if (!$this->exceptionHandler) {
 
  592        call_user_func($this->exceptionHandler, $e, $record);
 
  607        $level = static::toMonologLevel($level);
 
  789        self::$timezone = 
$tz;
 
An exception for terminatinating execution or to throw for unit testing.
Stores to any stream resource.
addEmergency($message, array $context=array())
Adds a log record at the EMERGENCY level.
addRecord($level, $message, array $context=array())
Adds a log record.
emergency($message, array $context=array())
Adds a log record at the EMERGENCY level.
pushHandler(HandlerInterface $handler)
Pushes a handler on to the stack.
setHandlers(array $handlers)
Set handlers, replacing all existing ones.
setExceptionHandler($callback)
Set a custom exception handler.
warning($message, array $context=array())
Adds a log record at the WARNING level.
err($message, array $context=array())
Adds a log record at the ERROR level.
crit($message, array $context=array())
Adds a log record at the CRITICAL level.
pushProcessor($callback)
Adds a processor on to the stack.
static toMonologLevel($level)
Converts PSR-3 levels to Monolog ones if necessary.
useMicrosecondTimestamps($micro)
Control the use of microsecond resolution timestamps in the 'datetime' member of new records.
addInfo($message, array $context=array())
Adds a log record at the INFO level.
info($message, array $context=array())
Adds a log record at the INFO level.
static getLevelName($level)
Gets the name of the logging level.
reset()
Ends a log cycle and resets all handlers and processors to their initial state.
log($level, $message, array $context=array())
Adds a log record at an arbitrary level.
notice($message, array $context=array())
Adds a log record at the NOTICE level.
debug($message, array $context=array())
Adds a log record at the DEBUG level.
popProcessor()
Removes the processor on top of the stack and returns it.
__construct($name, array $handlers=array(), array $processors=array())
static getLevels()
Gets all supported logging levels.
handleException(Exception $e, array $record)
Delegates exception management to the custom exception handler, or throws the exception if no custom ...
critical($message, array $context=array())
Adds a log record at the CRITICAL level.
addAlert($message, array $context=array())
Adds a log record at the ALERT level.
emerg($message, array $context=array())
Adds a log record at the EMERGENCY level.
isHandling($level)
Checks whether the Logger has a handler that listens on the given level.
alert($message, array $context=array())
Adds a log record at the ALERT level.
popHandler()
Pops a handler from the stack.
close()
Ends a log cycle and frees all resources used by handlers.
addDebug($message, array $context=array())
Adds a log record at the DEBUG level.
error($message, array $context=array())
Adds a log record at the ERROR level.
addError($message, array $context=array())
Adds a log record at the ERROR level.
addCritical($message, array $context=array())
Adds a log record at the CRITICAL level.
addNotice($message, array $context=array())
Adds a log record at the NOTICE level.
withName($name)
Return a new cloned instance with the name changed.
static setTimezone(\DateTimeZone $tz)
Set the timezone to be used for the timestamp of log records.
warn($message, array $context=array())
Adds a log record at the WARNING level.
addWarning($message, array $context=array())
Adds a log record at the WARNING level.
Interface that all Monolog Handlers must implement.
Handler or Processor implementing this interface will be reset when Logger::reset() is called.
Describes a logger instance.
catch(Exception $e) $message