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
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
$channelToActionLevel
private
array<string, Level>
$channelToActionLevel
$defaultActionLevel
private
Level
$defaultActionLevel
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
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>