Subversion-Projekte lars-tiefland.laravel_shop

Revision

Details | Letzte Änderung | Log anzeigen | RSS feed

Revision Autor Zeilennr. Zeile
148 lars 1
<?php declare(strict_types=1);
2
 
3
/*
4
 * This file is part of the Monolog package.
5
 *
6
 * (c) Jordi Boggiano <j.boggiano@seld.be>
7
 *
8
 * For the full copyright and license information, please view the LICENSE
9
 * file that was distributed with this source code.
10
 */
11
 
12
namespace Monolog\Handler\FingersCrossed;
13
 
14
use Monolog\Logger;
15
use Psr\Log\LogLevel;
16
 
17
/**
18
 * Error level based activation strategy.
19
 *
20
 * @author Johannes M. Schmitt <schmittjoh@gmail.com>
21
 *
22
 * @phpstan-import-type Level from \Monolog\Logger
23
 * @phpstan-import-type LevelName from \Monolog\Logger
24
 */
25
class ErrorLevelActivationStrategy implements ActivationStrategyInterface
26
{
27
    /**
28
     * @var Level
29
     */
30
    private $actionLevel;
31
 
32
    /**
33
     * @param int|string $actionLevel Level or name or value
34
     *
35
     * @phpstan-param Level|LevelName|LogLevel::* $actionLevel
36
     */
37
    public function __construct($actionLevel)
38
    {
39
        $this->actionLevel = Logger::toMonologLevel($actionLevel);
40
    }
41
 
42
    public function isHandlerActivated(array $record): bool
43
    {
44
        return $record['level'] >= $this->actionLevel;
45
    }
46
}