1111
1212namespace Fbn \Debug ;
1313
14+ use Psr \Log \AbstractLogger ;
1415use Psr \Log \LoggerInterface ;
1516use Psr \Log \LogLevel ;
1617
1718/**
1819 * Very simple logger.
1920 */
20- class Logger implements LoggerInterface
21+ final class Logger extends AbstractLogger
2122{
2223 /**
2324 * Default date format.
@@ -56,111 +57,17 @@ public function __construct(
5657 }
5758
5859 /**
59- * System is unusable.
60- *
61- * @param string $message
62- * @param array $context
63- *
64- * @return void
65- */
66- public function emergency ($ message , array $ context = [])
67- {
68- }
69-
70- /**
71- * Action must be taken immediately.
72- *
73- * Example: Entire website down, database unavailable, etc. This should
74- * trigger the SMS alerts and wake you up.
75- *
76- * @param string $message
77- * @param array $context
78- *
79- * @return void
80- */
81- public function alert ($ message , array $ context = [])
82- {
83- }
84-
85- /**
86- * Critical conditions.
87- *
88- * Example: Application component unavailable, unexpected exception.
89- *
90- * @param string $message
91- * @param array $context
92- *
93- * @return void
94- */
95- public function critical ($ message , array $ context = [])
96- {
97- }
98-
99- /**
100- * Runtime errors that do not require immediate action but should typically
101- * be logged and monitored.
102- *
103- * @param string $message
104- * @param array $context
105- *
106- * @return void
107- */
108- public function error ($ message , array $ context = [])
109- {
110- }
111-
112- /**
113- * Exceptional occurrences that are not errors.
114- *
115- * Example: Use of deprecated APIs, poor use of an API, undesirable things
116- * that are not necessarily wrong.
117- *
118- * @param string $message
119- * @param array $context
120- *
121- * @return void
122- */
123- public function warning ($ message , array $ context = [])
124- {
125- }
126-
127- /**
128- * Normal but significant events.
129- *
130- * @param string $message
131- * @param array $context
132- *
133- * @return void
134- */
135- public function notice ($ message , array $ context = [])
136- {
137- }
138-
139- /**
140- * Interesting events.
141- *
142- * Example: User logs in, SQL logs.
143- *
144- * @param string $message
145- * @param array $context
146- *
147- * @return void
148- */
149- public function info ($ message , array $ context = [])
150- {
151- }
152-
153- /**
154- * Detailed debug information.
60+ * Logs with an arbitrary level.
15561 *
62+ * @param mixed $level
15663 * @param string $message
15764 * @param array $context
15865 *
15966 * @return void
16067 */
161- public function debug ( $ message , array $ context = [])
68+ public function log ( $ level , $ message , array $ context = [])
16269 {
163- if ($ this ->logfile == null ) {
70+ if ($ level !== LogLevel:: DEBUG || $ this ->logfile == null ) {
16471 return ;
16572 }
16673
@@ -171,20 +78,4 @@ public function debug($message, array $context = [])
17178 FILE_APPEND | LOCK_EX
17279 );
17380 }
174-
175- /**
176- * Logs with an arbitrary level.
177- *
178- * @param mixed $level
179- * @param string $message
180- * @param array $context
181- *
182- * @return void
183- */
184- public function log ($ level , $ message , array $ context = [])
185- {
186- if ($ level === LogLevel::DEBUG ) {
187- $ this ->debug ($ message , $ context );
188- }
189- }
19081}
0 commit comments