ILIAS  release_5-3 Revision v5.3.23-19-g915713cf615
Monolog\Handler\FingersCrossed\ChannelLevelActivationStrategy Class Reference

Channel and Error level based monolog activation strategy. More...

+ Inheritance diagram for Monolog\Handler\FingersCrossed\ChannelLevelActivationStrategy:
+ Collaboration diagram for Monolog\Handler\FingersCrossed\ChannelLevelActivationStrategy:

Public Member Functions

 __construct ($defaultActionLevel, $channelToActionLevel=array())
 
 isHandlerActivated (array $record)
 Returns whether the given record activates the handler. More...
 

Private Attributes

 $defaultActionLevel
 
 $channelToActionLevel
 

Detailed Description

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);

Author
Mike Meessen netmi.nosp@m.key@.nosp@m.gmail.nosp@m..com

Definition at line 36 of file ChannelLevelActivationStrategy.php.

Constructor & Destructor Documentation

◆ __construct()

Monolog\Handler\FingersCrossed\ChannelLevelActivationStrategy::__construct (   $defaultActionLevel,
  $channelToActionLevel = array() 
)
Parameters
int$defaultActionLevelThe default action level to be used if the record's category doesn't match any
array$channelToActionLevelAn array that maps channel names to action levels.

Definition at line 45 of file ChannelLevelActivationStrategy.php.

References Monolog\Handler\FingersCrossed\ChannelLevelActivationStrategy\$channelToActionLevel, Monolog\Handler\FingersCrossed\ChannelLevelActivationStrategy\$defaultActionLevel, and Monolog\Logger\toMonologLevel().

46  {
47  $this->defaultActionLevel = Logger::toMonologLevel($defaultActionLevel);
48  $this->channelToActionLevel = array_map('Monolog\Logger::toMonologLevel', $channelToActionLevel);
49  }
static toMonologLevel($level)
Converts PSR-3 levels to Monolog ones if necessary.
Definition: Logger.php:473
+ Here is the call graph for this function:

Member Function Documentation

◆ isHandlerActivated()

Monolog\Handler\FingersCrossed\ChannelLevelActivationStrategy::isHandlerActivated ( array  $record)

Returns whether the given record activates the handler.

Parameters
array$record
Returns
Boolean

Implements Monolog\Handler\FingersCrossed\ActivationStrategyInterface.

Definition at line 51 of file ChannelLevelActivationStrategy.php.

References Monolog\Handler\FingersCrossed\ChannelLevelActivationStrategy\$defaultActionLevel.

52  {
53  if (isset($this->channelToActionLevel[$record['channel']])) {
54  return $record['level'] >= $this->channelToActionLevel[$record['channel']];
55  }
56 
57  return $record['level'] >= $this->defaultActionLevel;
58  }

Field Documentation

◆ $channelToActionLevel

Monolog\Handler\FingersCrossed\ChannelLevelActivationStrategy::$channelToActionLevel
private

◆ $defaultActionLevel

Monolog\Handler\FingersCrossed\ChannelLevelActivationStrategy::$defaultActionLevel
private

The documentation for this class was generated from the following file: