Sampling handler

A sampled event stream can be useful for logging high frequency events in
a production environment where you only need an idea of what is happening
and are not concerned with capturing every occurrence. Since the decision to
handle or not handle a particular event is determined randomly, the
resulting sampled log is not guaranteed to contain 1/N of the events that
occurred in the application, but based on the Law of large numbers, it will
tend to be close to this ratio with a large number of attempts.

CloneableInstantiable
ExtendsMonolog\Handler\Handler
Monolog\Handler\AbstractHandler
ImplementsMonolog\Handler\FormattableHandlerInterface
Monolog\Handler\HandlerInterface
Monolog\Handler\ProcessableHandlerInterface
Monolog\ResettableInterface
Methods
public __construct( $handler, int $factor)
 
  • psalm-param HandlerInterface|callable(array, HandlerInterface): HandlerInterface $handler
public Monolog\Handler\Handler::__destruct()
public Monolog\Handler\Handler::__sleep()
public Monolog\Handler\Handler::close() : void
 

{@inheritdoc}

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
 

{@inheritdoc}

public getHandler(?array $record = NULL)
 

Return the nested handler

If the handler was provided as a factory callable, this will trigger the handler's instantiation.

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

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

  • return int
public handle(array $record) : bool
public Monolog\Handler\Handler::handleBatch(array $records) : void
 

{@inheritdoc}

public isHandling(array $record) : bool
public popProcessor() : callable
 

{@inheritdoc}

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

{@inheritdoc}

  • suppress PhanTypeMismatchReturn
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
 

{@inheritdoc}

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

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

  • return self
Properties
protected Monolog\Handler\AbstractHandler::$bubble
protected $factor
 
  • var int $factor
protected $handler
 
protected Monolog\Handler\AbstractHandler::$level
protected $processors
 
  • var callable[]
Methods
protected processRecord(array $record) : array
 

Processes a record.

protected resetProcessors() : void
© 2020 Bruce Wells
Search Namespaces \ Classes
ConfigurationNumbers (0-9.) only