ILIAS  release_5-2 Revision v5.2.25-18-g3f80b828510
Monolog\Handler\AbstractHandler Class Reference

Base Handler class providing the Handler structure. More...

+ Inheritance diagram for Monolog\Handler\AbstractHandler:
+ Collaboration diagram for Monolog\Handler\AbstractHandler:

Public Member Functions

 __construct ($level=Logger::DEBUG, $bubble=true)
 
 isHandling (array $record)
 {Checks whether the given record will be handled by this handler.This is mostly done for performance reasons, to avoid calling processors for nothing.Handlers should still check the record levels within handle(), returning false in isHandling() is no guarantee that handle() will not be called, and isHandling() might not be called for a given record.
Parameters
array$recordPartial log record containing only a level key
Returns
Boolean
} More...
 
 handleBatch (array $records)
 {Handles a set of records at once.
Parameters
array$recordsThe records to handle (an array of record arrays)
} More...
 
 close ()
 Closes the handler. More...
 
 pushProcessor ($callback)
 {Adds a processor in the stack.
Parameters
callable$callback
Returns
self
} More...
 
 popProcessor ()
 {Removes the processor on top of the stack and returns it.
Returns
callable
} More...
 
 setFormatter (FormatterInterface $formatter)
 {Sets the formatter.
Parameters
FormatterInterface$formatter
Returns
self
} More...
 
 getFormatter ()
 {Gets the formatter.
Returns
FormatterInterface
} More...
 
 setLevel ($level)
 Sets minimum logging level at which this handler will be triggered. More...
 
 getLevel ()
 Gets minimum logging level at which this handler will be triggered. More...
 
 setBubble ($bubble)
 Sets the bubbling behavior. More...
 
 getBubble ()
 Gets the bubbling behavior. More...
 
 __destruct ()
 
- Public Member Functions inherited from Monolog\Handler\HandlerInterface
 handle (array $record)
 Handles a record. More...
 

Protected Member Functions

 getDefaultFormatter ()
 Gets the default formatter. More...
 

Protected Attributes

 $level = Logger::DEBUG
 
 $bubble = true
 
 $formatter
 
 $processors = array()
 

Detailed Description

Base Handler class providing the Handler structure.

Author
Jordi Boggiano j.bog.nosp@m.gian.nosp@m.o@sel.nosp@m.d.be

Definition at line 23 of file AbstractHandler.php.

Constructor & Destructor Documentation

◆ __construct()

Monolog\Handler\AbstractHandler::__construct (   $level = Logger::DEBUG,
  $bubble = true 
)
Parameters
int$levelThe minimum logging level at which this handler will be triggered
Boolean$bubbleWhether the messages that are handled can bubble up the stack or not

Definition at line 38 of file AbstractHandler.php.

References Monolog\Handler\AbstractHandler\$bubble, Monolog\Handler\AbstractHandler\$level, and Monolog\Handler\AbstractHandler\setLevel().

39  {
40  $this->setLevel($level);
41  $this->bubble = $bubble;
42  }
setLevel($level)
Sets minimum logging level at which this handler will be triggered.
+ Here is the call graph for this function:

◆ __destruct()

Monolog\Handler\AbstractHandler::__destruct ( )

Definition at line 166 of file AbstractHandler.php.

References Monolog\Handler\AbstractHandler\close().

167  {
168  try {
169  $this->close();
170  } catch (\Exception $e) {
171  // do nothing
172  } catch (\Throwable $e) {
173  // do nothing
174  }
175  }
+ Here is the call graph for this function:

Member Function Documentation

◆ close()

Monolog\Handler\AbstractHandler::close ( )

Closes the handler.

This will be called automatically when the object is destroyed

Definition at line 67 of file AbstractHandler.php.

Referenced by Monolog\Handler\AbstractHandler\__destruct().

68  {
69  }
+ Here is the caller graph for this function:

◆ getBubble()

Monolog\Handler\AbstractHandler::getBubble ( )

Gets the bubbling behavior.

Returns
Boolean true means that this handler allows bubbling. false means that bubbling is not permitted.

Definition at line 161 of file AbstractHandler.php.

References Monolog\Handler\AbstractHandler\$bubble.

162  {
163  return $this->bubble;
164  }

◆ getDefaultFormatter()

Monolog\Handler\AbstractHandler::getDefaultFormatter ( )
protected

Gets the default formatter.

Returns
FormatterInterface

Definition at line 182 of file AbstractHandler.php.

Referenced by Monolog\Handler\AbstractHandler\getFormatter().

183  {
184  return new LineFormatter();
185  }
+ Here is the caller graph for this function:

◆ getFormatter()

Monolog\Handler\AbstractHandler::getFormatter ( )

◆ getLevel()

Monolog\Handler\AbstractHandler::getLevel ( )

Gets minimum logging level at which this handler will be triggered.

Returns
int

Definition at line 136 of file AbstractHandler.php.

References Monolog\Handler\AbstractHandler\$level.

137  {
138  return $this->level;
139  }

◆ handleBatch()

Monolog\Handler\AbstractHandler::handleBatch ( array  $records)

{Handles a set of records at once.

Parameters
array$recordsThe records to handle (an array of record arrays)
}

Implements Monolog\Handler\HandlerInterface.

Definition at line 55 of file AbstractHandler.php.

References Monolog\Handler\HandlerInterface\handle().

56  {
57  foreach ($records as $record) {
58  $this->handle($record);
59  }
60  }
handle(array $record)
Handles a record.
$records
Definition: simple_test.php:22
+ Here is the call graph for this function:

◆ isHandling()

Monolog\Handler\AbstractHandler::isHandling ( array  $record)

{Checks whether the given record will be handled by this handler.This is mostly done for performance reasons, to avoid calling processors for nothing.Handlers should still check the record levels within handle(), returning false in isHandling() is no guarantee that handle() will not be called, and isHandling() might not be called for a given record.

Parameters
array$recordPartial log record containing only a level key
Returns
Boolean
}

Implements Monolog\Handler\HandlerInterface.

Definition at line 47 of file AbstractHandler.php.

References Monolog\Handler\AbstractHandler\$level.

Referenced by Monolog\Handler\AbstractProcessingHandler\handle(), Monolog\Handler\PsrHandler\handle(), Monolog\Handler\AmqpHandler\handleBatch(), and Monolog\Handler\HipChatHandler\handleBatch().

48  {
49  return $record['level'] >= $this->level;
50  }
+ Here is the caller graph for this function:

◆ popProcessor()

Monolog\Handler\AbstractHandler::popProcessor ( )

{Removes the processor on top of the stack and returns it.

Returns
callable
}

Implements Monolog\Handler\HandlerInterface.

Definition at line 87 of file AbstractHandler.php.

88  {
89  if (!$this->processors) {
90  throw new \LogicException('You tried to pop from an empty processor stack.');
91  }
92 
93  return array_shift($this->processors);
94  }

◆ pushProcessor()

Monolog\Handler\AbstractHandler::pushProcessor (   $callback)

{Adds a processor in the stack.

Parameters
callable$callback
Returns
self
}

Implements Monolog\Handler\HandlerInterface.

Definition at line 74 of file AbstractHandler.php.

Referenced by Monolog\LoggerTest\testProcessorsAreExecuted().

75  {
76  if (!is_callable($callback)) {
77  throw new \InvalidArgumentException('Processors must be valid callables (callback or object with an __invoke method), '.var_export($callback, true).' given');
78  }
79  array_unshift($this->processors, $callback);
80 
81  return $this;
82  }
+ Here is the caller graph for this function:

◆ setBubble()

Monolog\Handler\AbstractHandler::setBubble (   $bubble)

Sets the bubbling behavior.

Parameters
Boolean$bubbletrue means that this handler allows bubbling. false means that bubbling is not permitted.
Returns
self

Definition at line 148 of file AbstractHandler.php.

References Monolog\Handler\AbstractHandler\$bubble.

149  {
150  $this->bubble = $bubble;
151 
152  return $this;
153  }

◆ setFormatter()

Monolog\Handler\AbstractHandler::setFormatter ( FormatterInterface  $formatter)

{Sets the formatter.

Parameters
FormatterInterface$formatter
Returns
self
}

Implements Monolog\Handler\HandlerInterface.

Definition at line 99 of file AbstractHandler.php.

References Monolog\Handler\AbstractHandler\$formatter.

Referenced by Monolog\Handler\FirePHPHandlerTest\testConcurrentHandlers(), and Monolog\Handler\FirePHPHandlerTest\testHeaders().

100  {
101  $this->formatter = $formatter;
102 
103  return $this;
104  }
+ Here is the caller graph for this function:

◆ setLevel()

Monolog\Handler\AbstractHandler::setLevel (   $level)

Sets minimum logging level at which this handler will be triggered.

Parameters
int | string$levelLevel or level name
Returns
self

Definition at line 124 of file AbstractHandler.php.

References Monolog\Handler\AbstractHandler\$level, and Monolog\Logger\toMonologLevel().

Referenced by Monolog\Handler\AbstractHandler\__construct().

125  {
126  $this->level = Logger::toMonologLevel($level);
127 
128  return $this;
129  }
static toMonologLevel($level)
Converts PSR-3 levels to Monolog ones if necessary.
Definition: Logger.php:473
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

Field Documentation

◆ $bubble

Monolog\Handler\AbstractHandler::$bubble = true
protected

Definition at line 26 of file AbstractHandler.php.

Referenced by Monolog\Handler\CouchDBHandler\__construct(), Monolog\Handler\DoctrineCouchDBHandler\__construct(), Monolog\Handler\GroupHandler\__construct(), Monolog\Handler\MandrillHandler\__construct(), Monolog\Handler\MongoDBHandler\__construct(), Monolog\Handler\SwiftMailerHandler\__construct(), Monolog\Handler\SyslogUdpHandler\__construct(), Monolog\Handler\LogEntriesHandler\__construct(), Monolog\Handler\LogglyHandler\__construct(), Monolog\Handler\PsrHandler\__construct(), Monolog\Handler\ErrorLogHandler\__construct(), Monolog\Handler\AbstractHandler\__construct(), Monolog\Handler\CubeHandler\__construct(), Monolog\Handler\AmqpHandler\__construct(), Monolog\Handler\IFTTTHandler\__construct(), Monolog\Handler\GelfHandler\__construct(), Monolog\Handler\SocketHandler\__construct(), Monolog\Handler\BufferHandler\__construct(), Monolog\Handler\RedisHandler\__construct(), Monolog\Handler\SyslogHandler\__construct(), Monolog\Handler\StreamHandler\__construct(), Monolog\Handler\FlowdockHandler\__construct(), Monolog\Handler\DynamoDbHandler\__construct(), Monolog\Handler\RotatingFileHandler\__construct(), Monolog\Handler\ZendMonitorHandler\__construct(), Monolog\Handler\RollbarHandler\__construct(), Monolog\Handler\FleepHookHandler\__construct(), Monolog\Handler\FingersCrossedHandler\__construct(), Monolog\Handler\ElasticSearchHandler\__construct(), Monolog\Handler\NewRelicHandler\__construct(), Monolog\Handler\AbstractSyslogHandler\__construct(), Monolog\Handler\RavenHandler\__construct(), Monolog\Handler\ChromePHPHandler\__construct(), Monolog\Handler\DeduplicationHandler\__construct(), Monolog\Handler\PHPConsoleHandler\__construct(), Monolog\Handler\NativeMailerHandler\__construct(), Monolog\Handler\PushoverHandler\__construct(), Monolog\Handler\SlackHandler\__construct(), Monolog\Handler\HipChatHandler\__construct(), Monolog\Handler\AbstractHandler\getBubble(), Monolog\Handler\WhatFailureGroupHandler\handle(), Monolog\Handler\AbstractProcessingHandler\handle(), Monolog\Handler\PsrHandler\handle(), Monolog\Handler\BufferHandler\handle(), Monolog\Handler\GroupHandler\handle(), Monolog\Handler\SamplingHandler\handle(), Monolog\Handler\FingersCrossedHandler\handle(), Monolog\Handler\PHPConsoleHandler\handle(), Monolog\Handler\HipChatHandler\handleBatch(), and Monolog\Handler\AbstractHandler\setBubble().

◆ $formatter

Monolog\Handler\AbstractHandler::$formatter
protected

◆ $level

Monolog\Handler\AbstractHandler::$level = Logger::DEBUG
protected

Definition at line 25 of file AbstractHandler.php.

Referenced by Monolog\Handler\TestHandler\__call(), Monolog\Handler\CouchDBHandler\__construct(), Monolog\Handler\DoctrineCouchDBHandler\__construct(), Monolog\Handler\NullHandler\__construct(), Monolog\Handler\MandrillHandler\__construct(), Monolog\Handler\MongoDBHandler\__construct(), Monolog\Handler\SwiftMailerHandler\__construct(), Monolog\Handler\SyslogUdpHandler\__construct(), Monolog\Handler\LogEntriesHandler\__construct(), Monolog\Handler\LogglyHandler\__construct(), Monolog\Handler\PsrHandler\__construct(), Monolog\Handler\ErrorLogHandler\__construct(), Monolog\Handler\AbstractHandler\__construct(), Monolog\Handler\CubeHandler\__construct(), Monolog\Handler\AmqpHandler\__construct(), Monolog\Handler\IFTTTHandler\__construct(), Monolog\Handler\GelfHandler\__construct(), Monolog\Handler\SocketHandler\__construct(), Monolog\Handler\BufferHandler\__construct(), Monolog\Handler\RedisHandler\__construct(), Monolog\Handler\SyslogHandler\__construct(), Monolog\Handler\StreamHandler\__construct(), Monolog\Handler\FlowdockHandler\__construct(), Monolog\Handler\DynamoDbHandler\__construct(), Monolog\Handler\RotatingFileHandler\__construct(), Monolog\Handler\ZendMonitorHandler\__construct(), Monolog\Handler\FleepHookHandler\__construct(), Monolog\Handler\RollbarHandler\__construct(), Monolog\Handler\ElasticSearchHandler\__construct(), Monolog\Handler\NewRelicHandler\__construct(), Monolog\Handler\AbstractSyslogHandler\__construct(), Monolog\Handler\RavenHandler\__construct(), Monolog\Handler\ChromePHPHandler\__construct(), Monolog\Handler\PHPConsoleHandler\__construct(), Monolog\Handler\NativeMailerHandler\__construct(), Monolog\Handler\PushoverHandler\__construct(), Monolog\Handler\SlackHandler\__construct(), Monolog\Handler\HipChatHandler\__construct(), Monolog\Handler\FingersCrossedHandler\close(), Monolog\Handler\HipChatHandler\combineRecords(), Monolog\Handler\HipChatHandler\getAlertColor(), Monolog\Handler\SlackHandler\getAttachmentColor(), Monolog\Handler\AbstractHandler\getLevel(), Monolog\Handler\LogglyHandler\handleBatch(), Monolog\Handler\RavenHandler\handleBatch(), Monolog\Handler\TestHandler\hasRecord(), Monolog\Handler\TestHandler\hasRecordRecords(), Monolog\Handler\TestHandler\hasRecordThatContains(), Monolog\Handler\TestHandler\hasRecordThatMatches(), Monolog\Handler\TestHandler\hasRecordThatPasses(), Monolog\Handler\DeduplicationHandler\isDuplicate(), Monolog\Handler\AbstractHandler\isHandling(), Monolog\Handler\FilterHandler\setAcceptedLevels(), Monolog\Handler\AbstractHandler\setLevel(), and Monolog\Handler\ZendMonitorHandler\writeZendMonitorCustomEvent().

◆ $processors

Monolog\Handler\AbstractHandler::$processors = array()
protected

Definition at line 32 of file AbstractHandler.php.


The documentation for this class was generated from the following file: