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.

public __construct(Monolog\Handler\HandlerInterface $handler, ?string $deduplicationStore = NULL, $deduplicationLevel = 400, int $time = 60, bool $bubble = true)

    public Monolog\Handler\BufferHandler::__destruct()
    public Monolog\Handler\Handler::__sleep()
    public Monolog\Handler\BufferHandler::clear() : void
    Clears the buffer without flushing any messages down to the wrapped handler.

    public Monolog\Handler\BufferHandler::close() : void

    public flush() : void
    public Monolog\Handler\AbstractHandler::getBubble() : bool
    Gets the bubbling behavior.

    • return bool true means that this handler allows bubbling. false means that bubbling is not permitted.
    public Monolog\Handler\BufferHandler::getFormatter() : Monolog\Formatter\FormatterInterface

    public Monolog\Handler\AbstractHandler::getLevel() : int
    Gets minimum logging level at which this handler will be triggered.

    • return int
    public Monolog\Handler\BufferHandler::handle(array $record) : bool

    public Monolog\Handler\Handler::handleBatch(array $records) : void

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

    public Monolog\Handler\BufferHandler::popProcessor() : callable

    public Monolog\Handler\BufferHandler::pushProcessor(callable $callback) : Monolog\Handler\HandlerInterface

    • suppress PhanTypeMismatchReturn
    public Monolog\Handler\BufferHandler::reset()
    public Monolog\Handler\AbstractHandler::setBubble(bool $bubble) : self
    Sets the bubbling behavior.

    • return self
    public Monolog\Handler\BufferHandler::setFormatter(Monolog\Formatter\FormatterInterface $formatter) : Monolog\Handler\HandlerInterface

    public Monolog\Handler\AbstractHandler::setLevel( $level) : self
    Sets minimum logging level at which this handler will be triggered.

    • return self
    protected Monolog\Handler\AbstractHandler::$bubble
    protected Monolog\Handler\BufferHandler::$buffer
    protected Monolog\Handler\BufferHandler::$bufferLimit
    protected Monolog\Handler\BufferHandler::$bufferSize
    protected $deduplicationLevel

    • var int
    protected $deduplicationStore

    • var string
    protected Monolog\Handler\BufferHandler::$flushOnOverflow
    protected Monolog\Handler\BufferHandler::$handler
    protected Monolog\Handler\BufferHandler::$initialized
    protected Monolog\Handler\AbstractHandler::$level
    protected Monolog\Handler\BufferHandler::$processors

    • var callable[]
    protected $time

    • var int
    protected Monolog\Handler\BufferHandler::processRecord(array $record) : array
    Processes a record.

    protected Monolog\Handler\BufferHandler::resetProcessors() : void
    private $gc

    • var bool
    private appendRecord(array $record) : void
    private collectLogs() : void
    private isDuplicate(array $record) : bool
    © 2020 Bruce Wells
    Search Namespaces \ Classes
    ConfigurationNumbers (0-9.) only