PluginProbe
WPIDE – File Manager & Code Editor / 3.5.9
WPIDE – File Manager & Code Editor v3.5.9
3.5.9 3.5.8 3.5.7 2.0.14 2.0.15 2.0.16 2.0.2 2.0.4 2.0.5 2.0.6 2.0.7 2.0.8 2.0.9 2.1 2.2 2.3 2.3.1 2.3.2 2.4.0 2.5 2.6 3.0 3.1 3.2 3.3 All 55 releases
wpide / vendor / monolog / monolog / src / Monolog / Handler / AbstractHandler.php

AbstractHandler.php in WPIDE – File Manager & Code Editor 3.5.9, at vendor/monolog/monolog/src/Monolog/Handler/AbstractHandler.php

113 lines 2.6 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php declare(strict_types=1);
2
3 /*
4 * This file is part of the Monolog package.
5 *
6 * (c) Jordi Boggiano <[email protected]>
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;
13
14 use Monolog\Logger;
15 use Monolog\ResettableInterface;
16 use Psr\Log\LogLevel;
17
18 /**
19 * Base Handler class providing basic level/bubble support
20 *
21 * @author Jordi Boggiano <[email protected]>
22 *
23 * @phpstan-import-type Level from \Monolog\Logger
24 * @phpstan-import-type LevelName from \Monolog\Logger
25 */
26 abstract class AbstractHandler extends Handler implements ResettableInterface
27 {
28 /**
29 * @var int
30 * @phpstan-var Level
31 */
32 protected $level = Logger::DEBUG;
33 /** @var bool */
34 protected $bubble = true;
35
36 /**
37 * @param int|string $level The minimum logging level at which this handler will be triggered
38 * @param bool $bubble Whether the messages that are handled can bubble up the stack or not
39 *
40 * @phpstan-param Level|LevelName|LogLevel::* $level
41 */
42 public function __construct($level = Logger::DEBUG, bool $bubble = true)
43 {
44 $this->setLevel($level);
45 $this->bubble = $bubble;
46 }
47
48 /**
49 * {@inheritDoc}
50 */
51 public function isHandling(array $record): bool
52 {
53 return $record['level'] >= $this->level;
54 }
55
56 /**
57 * Sets minimum logging level at which this handler will be triggered.
58 *
59 * @param Level|LevelName|LogLevel::* $level Level or level name
60 * @return self
61 */
62 public function setLevel($level): self
63 {
64 $this->level = Logger::toMonologLevel($level);
65
66 return $this;
67 }
68
69 /**
70 * Gets minimum logging level at which this handler will be triggered.
71 *
72 * @return int
73 *
74 * @phpstan-return Level
75 */
76 public function getLevel(): int
77 {
78 return $this->level;
79 }
80
81 /**
82 * Sets the bubbling behavior.
83 *
84 * @param bool $bubble true means that this handler allows bubbling.
85 * false means that bubbling is not permitted.
86 * @return self
87 */
88 public function setBubble(bool $bubble): self
89 {
90 $this->bubble = $bubble;
91
92 return $this;
93 }
94
95 /**
96 * Gets the bubbling behavior.
97 *
98 * @return bool true means that this handler allows bubbling.
99 * false means that bubbling is not permitted.
100 */
101 public function getBubble(): bool
102 {
103 return $this->bubble;
104 }
105
106 /**
107 * {@inheritDoc}
108 */
109 public function reset()
110 {
111 }
112 }
113