1 | <?php |
||
17 | trait StaticLoggerTrait |
||
18 | { |
||
19 | /** |
||
20 | * System is unusable. |
||
21 | * |
||
22 | * @param string $message |
||
23 | * @param array $context |
||
24 | */ |
||
25 | public static function emergency($message, array $context = []) |
||
29 | |||
30 | /** |
||
31 | * Action must be taken immediately. |
||
32 | * |
||
33 | * Example: Entire website down, database unavailable, etc. This should |
||
34 | * trigger the SMS alerts and wake you up. |
||
35 | * |
||
36 | * @param string $message |
||
37 | * @param array $context |
||
38 | */ |
||
39 | public static function alert($message, array $context = []) |
||
43 | |||
44 | /** |
||
45 | * Critical conditions. |
||
46 | * |
||
47 | * Example: Application component unavailable, unexpected exception. |
||
48 | * |
||
49 | * @param string $message |
||
50 | * @param array $context |
||
51 | */ |
||
52 | public static function critical($message, array $context = []) |
||
56 | |||
57 | /** |
||
58 | * Runtime errors that do not require immediate action but should typically |
||
59 | * be logged and monitored. |
||
60 | * |
||
61 | * @param string $message |
||
62 | * @param array $context |
||
63 | */ |
||
64 | public static function error($message, array $context = []) |
||
68 | |||
69 | /** |
||
70 | * Exceptional occurrences that are not errors. |
||
71 | * |
||
72 | * Example: Use of deprecated APIs, poor use of an API, undesirable things |
||
73 | * that are not necessarily wrong. |
||
74 | * |
||
75 | * @param string $message |
||
76 | * @param array $context |
||
77 | */ |
||
78 | public static function warning($message, array $context = []) |
||
82 | |||
83 | /** |
||
84 | * Normal but significant events. |
||
85 | * |
||
86 | * @param string $message |
||
87 | * @param array $context |
||
88 | */ |
||
89 | public static function notice($message, array $context = []) |
||
93 | |||
94 | /** |
||
95 | * Interesting events. |
||
96 | * |
||
97 | * Example: User logs in, SQL logs. |
||
98 | * |
||
99 | * @param string $message |
||
100 | * @param array $context |
||
101 | */ |
||
102 | public static function info($message, array $context = []) |
||
106 | |||
107 | /** |
||
108 | * Detailed debug information. |
||
109 | * |
||
110 | * @param string $message |
||
111 | * @param array $context |
||
112 | */ |
||
113 | public static function debug($message, array $context = []) |
||
117 | |||
118 | /** |
||
119 | * Logs with an arbitrary level. |
||
120 | * |
||
121 | * @param mixed $level |
||
122 | * @param string $message |
||
123 | * @param array $context |
||
124 | */ |
||
125 | abstract public static function log($level, $message, array $context = []); |
||
126 | } |
||
127 |