ILIAS  release_5-4 Revision v5.4.26-12-gabc799a52e6
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
bool
} 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 ()
 
 reset ()
 
- Public Member Functions inherited from Monolog\Handler\HandlerInterface
 isHandling (array $record)
 Checks whether the given record will be handled by this handler. More...
 
 handle (array $record)
 Handles a record. More...
 
 handleBatch (array $records)
 Handles a set of records at once. More...
 
 pushProcessor ($callback)
 Adds a processor in the stack. More...
 
 popProcessor ()
 Removes the processor on top of the stack and returns it. More...
 
 setFormatter (FormatterInterface $formatter)
 Sets the formatter. More...
 
 getFormatter ()
 Gets the formatter. More...
 
 reset ()
 

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 24 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
bool$bubbleWhether the messages that are handled can bubble up the stack or not

Reimplemented in Monolog\Handler\SamplingHandler, Monolog\Handler\ChromePHPHandler, and Monolog\Handler\ZendMonitorHandler.

Definition at line 39 of file AbstractHandler.php.

40 {
41 $this->setLevel($level);
42 $this->bubble = $bubble;
43 }
setLevel($level)
Sets minimum logging level at which this handler will be triggered.

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

+ Here is the call graph for this function:

◆ __destruct()

Monolog\Handler\AbstractHandler::__destruct ( )

Reimplemented in Monolog\Handler\BufferHandler.

Definition at line 167 of file AbstractHandler.php.

168 {
169 try {
170 $this->close();
171 } catch (\Exception $e) {
172 // do nothing
173 } catch (\Throwable $e) {
174 // do nothing
175 }
176 }

References Monolog\Handler\AbstractHandler\close().

+ Here is the call graph for this function:

Member Function Documentation

◆ close()

Monolog\Handler\AbstractHandler::close ( )

◆ getBubble()

Monolog\Handler\AbstractHandler::getBubble ( )

Gets the bubbling behavior.

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

Definition at line 162 of file AbstractHandler.php.

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

References Monolog\Handler\AbstractHandler\$bubble.

◆ getDefaultFormatter()

◆ getFormatter()

◆ getLevel()

Monolog\Handler\AbstractHandler::getLevel ( )

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

Returns
int

Definition at line 137 of file AbstractHandler.php.

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

References Monolog\Handler\AbstractHandler\$level.

◆ 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.

Reimplemented in Monolog\Handler\AmqpHandler, Monolog\Handler\ChromePHPHandler, Monolog\Handler\ElasticSearchHandler, Monolog\Handler\FilterHandler, Monolog\Handler\GroupHandler, Monolog\Handler\HipChatHandler, Monolog\Handler\LogglyHandler, Monolog\Handler\MailHandler, Monolog\Handler\RavenHandler, and Monolog\Handler\WhatFailureGroupHandler.

Definition at line 56 of file AbstractHandler.php.

57 {
58 foreach ($records as $record) {
59 $this->handle($record);
60 }
61 }
handle(array $record)
Handles a record.
$records
Definition: simple_test.php:22

References $records, and Monolog\Handler\HandlerInterface\handle().

+ 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
bool
}

Implements Monolog\Handler\HandlerInterface.

Reimplemented in Monolog\Handler\FilterHandler, Monolog\Handler\FingersCrossedHandler, Monolog\Handler\GroupHandler, and Monolog\Handler\SamplingHandler.

Definition at line 48 of file AbstractHandler.php.

49 {
50 return $record['level'] >= $this->level;
51 }

References Monolog\Handler\AbstractHandler\$level.

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

+ 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 88 of file AbstractHandler.php.

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

◆ pushProcessor()

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

{Adds a processor in the stack.

Parameters
callable$callback
Returns
self
}

Implements Monolog\Handler\HandlerInterface.

Definition at line 75 of file AbstractHandler.php.

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

Referenced by Monolog\LoggerTest\testProcessorsAreExecuted().

+ Here is the caller graph for this function:

◆ reset()

Monolog\Handler\AbstractHandler::reset ( )

Implements Monolog\ResettableInterface.

Reimplemented in Monolog\Handler\BrowserConsoleHandler, Monolog\Handler\BufferHandler, Monolog\Handler\FingersCrossedHandler, Monolog\Handler\GroupHandler, Monolog\Handler\RollbarHandler, and Monolog\Handler\RotatingFileHandler.

Definition at line 178 of file AbstractHandler.php.

179 {
180 foreach ($this->processors as $processor) {
181 if ($processor instanceof ResettableInterface) {
182 $processor->reset();
183 }
184 }
185 }

◆ setBubble()

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

Sets the bubbling behavior.

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

Definition at line 149 of file AbstractHandler.php.

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

References Monolog\Handler\AbstractHandler\$bubble.

◆ setFormatter()

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

{Sets the formatter.

Parameters
FormatterInterface$formatter
Returns
self
}

Implements Monolog\Handler\HandlerInterface.

Reimplemented in Monolog\Handler\ElasticSearchHandler, Monolog\Handler\FlowdockHandler, Monolog\Handler\GroupHandler, Monolog\Handler\SlackHandler, and Monolog\Handler\SlackWebhookHandler.

Definition at line 100 of file AbstractHandler.php.

101 {
102 $this->formatter = $formatter;
103
104 return $this;
105 }

References Monolog\Handler\AbstractHandler\$formatter.

Referenced by Monolog\Handler\FirePHPHandlerTest\testConcurrentHandlers().

+ 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 125 of file AbstractHandler.php.

126 {
127 $this->level = Logger::toMonologLevel($level);
128
129 return $this;
130 }
static toMonologLevel($level)
Converts PSR-3 levels to Monolog ones if necessary.
Definition: Logger.php:528

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

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

+ 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 27 of file AbstractHandler.php.

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

◆ $formatter

◆ $level

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

Definition at line 26 of file AbstractHandler.php.

Referenced by Monolog\Handler\TestHandler\__call(), Monolog\Handler\NewRelicHandler\__construct(), Monolog\Handler\MandrillHandler\__construct(), Monolog\Handler\FlowdockHandler\__construct(), Monolog\Handler\SocketHandler\__construct(), Monolog\Handler\IFTTTHandler\__construct(), Monolog\Handler\AmqpHandler\__construct(), Monolog\Handler\AbstractSyslogHandler\__construct(), Monolog\Handler\RotatingFileHandler\__construct(), Monolog\Handler\SyslogUdpHandler\__construct(), Monolog\Handler\SyslogHandler\__construct(), Monolog\Handler\NullHandler\__construct(), Monolog\Handler\AbstractHandler\__construct(), Monolog\Handler\ChromePHPHandler\__construct(), Monolog\Handler\ZendMonitorHandler\__construct(), Monolog\Handler\ErrorLogHandler\__construct(), Monolog\Handler\MongoDBHandler\__construct(), Monolog\Handler\GelfHandler\__construct(), Monolog\Handler\RedisHandler\__construct(), Monolog\Handler\SlackbotHandler\__construct(), Monolog\Handler\StreamHandler\__construct(), Monolog\Handler\NativeMailerHandler\__construct(), Monolog\Handler\SlackHandler\__construct(), Monolog\Handler\FleepHookHandler\__construct(), Monolog\Handler\LogglyHandler\__construct(), Monolog\Handler\InsightOpsHandler\__construct(), Monolog\Handler\HipChatHandler\__construct(), Monolog\Handler\PushoverHandler\__construct(), Monolog\Handler\LogEntriesHandler\__construct(), Monolog\Handler\CubeHandler\__construct(), Monolog\Handler\SlackWebhookHandler\__construct(), Monolog\Handler\SwiftMailerHandler\__construct(), Monolog\Handler\CouchDBHandler\__construct(), Monolog\Handler\PHPConsoleHandler\__construct(), Monolog\Handler\ElasticSearchHandler\__construct(), Monolog\Handler\DoctrineCouchDBHandler\__construct(), Monolog\Handler\DynamoDbHandler\__construct(), Monolog\Handler\BufferHandler\__construct(), Monolog\Handler\PsrHandler\__construct(), Monolog\Handler\RavenHandler\__construct(), Monolog\Handler\RollbarHandler\__construct(), Monolog\Handler\HipChatHandler\combineRecords(), Monolog\Handler\FingersCrossedHandler\flushBuffer(), 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\hasRecords(), 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 33 of file AbstractHandler.php.


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