Repository navigation
Expand file tree
/
Copy pathLogLevel.php
More file actions
61 lines (57 loc) · 1.4 KB
/
Copy pathLogLevel.php
File metadata and controls
61 lines (57 loc) · 1.4 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
<?php
declare(strict_types=1);
namespace PHPForge\Debug\Helper;
/**
* Defines the log-level wire values persisted inside debug snapshots.
*/
final class LogLevel
{
/**
* Error message level.
*/
public const int ERROR = 0x01;
/**
* Informational message level.
*/
public const int INFO = 0x04;
/**
* Profiling message level.
*/
public const int PROFILE = 0x40;
/**
* Profiling begin marker level.
*/
public const int PROFILE_BEGIN = 0x50;
/**
* Profiling end marker level.
*/
public const int PROFILE_END = 0x60;
/**
* Tracing message level.
*/
public const int TRACE = 0x08;
/**
* Warning message level.
*/
public const int WARNING = 0x02;
/**
* Returns the lowercase display name of a level, matching the Yii logger naming.
*
* @param int $level Log-level wire value.
*
* @return string Display name; `unknown` for unrecognized values.
*/
public static function name(int $level): string
{
return match ($level) {
self::ERROR => 'error',
self::WARNING => 'warning',
self::INFO => 'info',
self::TRACE => 'trace',
self::PROFILE => 'profile',
self::PROFILE_BEGIN => 'profile begin',
self::PROFILE_END => 'profile end',
default => 'unknown',
};
}
}