ILIAS
release_5-3 Revision v5.3.23-19-g915713cf615
|
Simple handler wrapper that deduplicates log records across multiple requests. More...
Public Member Functions | ||||
__construct (HandlerInterface $handler, $deduplicationStore=null, $deduplicationLevel=Logger::ERROR, $time=60, $bubble=true) | ||||
flush () | ||||
Public Member Functions inherited from Monolog\Handler\BufferHandler | ||||
__construct (HandlerInterface $handler, $bufferLimit=0, $level=Logger::DEBUG, $bubble=true, $flushOnOverflow=false) | ||||
handle (array $record) | ||||
{Handles a record.All records may be passed to this method, and the handler should discard those that it does not want to handle.The return value of this function controls the bubbling process of the handler stack. Unless the bubbling is interrupted (by returning true), the Logger class will keep on calling further handlers in the stack with a given log record.
| ||||
flush () | ||||
__destruct () | ||||
close () | ||||
{} More... | ||||
clear () | ||||
Clears the buffer without flushing any messages down to the wrapped handler. More... | ||||
Public Member Functions inherited from Monolog\Handler\AbstractHandler | ||||
__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.
| ||||
handleBatch (array $records) | ||||
{Handles a set of records at once.
| ||||
close () | ||||
Closes the handler. More... | ||||
pushProcessor ($callback) | ||||
{Adds a processor in the stack.
| ||||
popProcessor () | ||||
{Removes the processor on top of the stack and returns it.
| ||||
setFormatter (FormatterInterface $formatter) | ||||
{Sets the formatter.
| ||||
getFormatter () | ||||
{Gets the formatter.
| ||||
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 () | ||||
Protected Attributes | |
$deduplicationStore | |
$deduplicationLevel | |
$time | |
Protected Attributes inherited from Monolog\Handler\BufferHandler | |
$handler | |
$bufferSize = 0 | |
$bufferLimit | |
$flushOnOverflow | |
$buffer = array() | |
$initialized = false | |
Protected Attributes inherited from Monolog\Handler\AbstractHandler | |
$level = Logger::DEBUG | |
$bubble = true | |
$formatter | |
$processors = array() | |
Private Member Functions | |
isDuplicate (array $record) | |
collectLogs () | |
appendRecord (array $record) | |
Private Attributes | |
$gc = false | |
Additional Inherited Members | |
Protected Member Functions inherited from Monolog\Handler\AbstractHandler | |
getDefaultFormatter () | |
Gets the default formatter. More... | |
Simple handler wrapper that deduplicates log records across multiple requests.
It also includes the BufferHandler functionality and will buffer all messages until the end of the request or flush() is called.
This works by storing all log records' messages above $deduplicationLevel to the file specified by $deduplicationStore. When further logs come in at the end of the request (or when flush() is called), all those above $deduplicationLevel are checked against the existing stored logs. If they match and the timestamps in the stored log is not older than $time seconds, the new log record is discarded. If no log record is new, the whole data set is discarded.
This is mainly useful in combination with Mail handlers or things like Slack or HipChat handlers that send messages to people, to avoid spamming with the same message over and over in case of a major component failure like a database server being down which makes all requests fail in the same way.
Definition at line 36 of file DeduplicationHandler.php.
Monolog\Handler\DeduplicationHandler::__construct | ( | HandlerInterface | $handler, |
$deduplicationStore = null , |
|||
$deduplicationLevel = Logger::ERROR , |
|||
$time = 60 , |
|||
$bubble = true |
|||
) |
HandlerInterface | $handler | Handler. |
string | $deduplicationStore | The file/path where the deduplication log should be kept |
int | $deduplicationLevel | The minimum logging level for log records to be looked at for deduplication purposes |
int | $time | The period (in seconds) during which duplicate entries should be suppressed after a given log is sent through |
Boolean | $bubble | Whether the messages that are handled can bubble up the stack or not |
Definition at line 65 of file DeduplicationHandler.php.
References Monolog\Handler\AbstractHandler\$bubble, Monolog\Handler\DeduplicationHandler\$deduplicationLevel, Monolog\Handler\DeduplicationHandler\$deduplicationStore, Monolog\Handler\DeduplicationHandler\$time, Monolog\Logger\DEBUG, time, and Monolog\Logger\toMonologLevel().
|
private |
Definition at line 165 of file DeduplicationHandler.php.
Referenced by Monolog\Handler\DeduplicationHandler\flush().
|
private |
Definition at line 134 of file DeduplicationHandler.php.
References $log, Monolog\Handler\DeduplicationHandler\$time, array, and time.
Referenced by Monolog\Handler\DeduplicationHandler\flush().
Monolog\Handler\DeduplicationHandler::flush | ( | ) |
Definition at line 74 of file DeduplicationHandler.php.
References Monolog\Handler\DeduplicationHandler\appendRecord(), Monolog\Handler\BufferHandler\clear(), Monolog\Handler\DeduplicationHandler\collectLogs(), and Monolog\Handler\DeduplicationHandler\isDuplicate().
|
private |
Definition at line 104 of file DeduplicationHandler.php.
References $i, Monolog\Handler\AbstractHandler\$level, $message, $store, Monolog\Handler\DeduplicationHandler\$time, $timestamp, file, and time.
Referenced by Monolog\Handler\DeduplicationHandler\flush().
|
protected |
Definition at line 46 of file DeduplicationHandler.php.
Referenced by Monolog\Handler\DeduplicationHandler\__construct().
|
protected |
Definition at line 41 of file DeduplicationHandler.php.
Referenced by Monolog\Handler\DeduplicationHandler\__construct().
|
private |
Definition at line 56 of file DeduplicationHandler.php.
|
protected |
Definition at line 51 of file DeduplicationHandler.php.
Referenced by Monolog\Handler\DeduplicationHandler\__construct(), Monolog\Handler\DeduplicationHandler\collectLogs(), and Monolog\Handler\DeduplicationHandler\isDuplicate().