Documentation

ChannelLevelActivationStrategy
in package
implements ActivationStrategyInterface

Channel and Error level based monolog activation strategy. Allows to trigger activation based on level per channel. e.g. trigger activation on level 'ERROR' by default, except for records of the 'sql' channel; those should trigger activation on level 'WARN'.

Example:

$activationStrategy = new ChannelLevelActivationStrategy( Logger::CRITICAL, array( 'request' => Logger::ALERT, 'sensitive' => Logger::ERROR, ) ); $handler = new FingersCrossedHandler(new StreamHandler('php://stderr'), $activationStrategy);
Tags
author

Mike Meessen netmikey@gmail.com

phpstan-import-type

Record from \Monolog\Logger

phpstan-import-type

Level from \Monolog\Logger

phpstan-import-type

LevelName from \Monolog\Logger

Interfaces, Classes and Traits

ActivationStrategyInterface
Interface for activation strategies for the FingersCrossedHandler.

Table of Contents

$channelToActionLevel  : array<string, Level>
$defaultActionLevel  : Level
__construct()  : mixed
isHandlerActivated()  : bool
Returns whether the given record activates the handler.

Properties

Methods

__construct()

public __construct(int|string $defaultActionLevel[, array<string, int> $channelToActionLevel = [] ]) : mixed
Parameters
$defaultActionLevel : int|string

The default action level to be used if the record's category doesn't match any

$channelToActionLevel : array<string, int> = []

An array that maps channel names to action levels.

Tags
phpstan-param

array<string, Level> $channelToActionLevel

phpstan-param

Level|LevelName|LogLevel::* $defaultActionLevel

Return values
mixed

isHandlerActivated()

Returns whether the given record activates the handler.

public isHandlerActivated(array<string|int, mixed> $record) : bool
Parameters
$record : array<string|int, mixed>
Tags
phpstan-param

Record $record

Return values
bool

Search results