Handler to only pass log messages when a certain threshold of number of messages is reached.

This can be useful in cases of processing a batch of data, but you're for example only interested
in case it fails catastrophically instead of a warning for 1 or 2 events. Worse things can happen, right?

Usage example:

  $log = new Logger('application');
  $handler = new SomeHandler(...)

  // Pass all warnings to the handler when more than 10 & all error messages when more then 5
  $overflow = new OverflowHandler($handler, [Logger::WARNING => 10, Logger::ERROR => 5]);

public __construct(Monolog\Handler\HandlerInterface $handler, array $thresholdMap = [], $level = 100, bool $bubble = true)
    public Monolog\Handler\Handler::__destruct()
    public Monolog\Handler\Handler::__sleep()
    public Monolog\Handler\Handler::close() : 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 getFormatter() : Monolog\Formatter\FormatterInterface


    public Monolog\Handler\AbstractHandler::getLevel() : int

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

    • return int
    public handle(array $record) : bool

    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.

    • return bool true means that this handler handled the record, and that bubbling is not permitted. false means the record was either not processed or that this handler allows bubbling.
    public Monolog\Handler\Handler::handleBatch(array $records) : void


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


    public Monolog\Handler\AbstractHandler::reset()
    public Monolog\Handler\AbstractHandler::setBubble(bool $bubble) : self

    Sets the bubbling behavior.

    • return self
    public 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\AbstractHandler::$level
    private $buffer

    Buffer of all messages passed to the handler before the threshold was reached

    • var array[]
    private $handler
    private $thresholdMap
    • var int[]
    © 2020 Bruce Wells
    Search Namespaces \ Classes
    ConfigurationNumbers (0-9.) only