@@ -163,7 +163,7 @@ to write logs using the :phpfunction:`syslog` function:
163163 ->type('stream')
164164 // log to var/logs/(environment).log
165165 ->path('%kernel.logs_dir%/%kernel.environment%.log')
166- // log *all* messages (debug is lowest level)
166+ // log *all* messages (LogLevel::DEBUG is lowest level)
167167 ->level(LogLevel::DEBUG);
168168
169169 $monolog->handler('syslog_handler')
@@ -254,31 +254,32 @@ one of the messages reaches an ``action_level``. Take this example:
254254 .. code-block :: php
255255
256256 // config/packages/prod/monolog.php
257+ use Psr\Log\LogLevel;
257258 use Symfony\Config\MonologConfig;
258259
259260 return static function (MonologConfig $monolog) {
260261 $monolog->handler('filter_for_errors')
261262 ->type('fingers_crossed')
262263 // if *one* log is error or higher, pass *all* to file_log
263- ->actionLevel('error' )
264+ ->actionLevel(LogLevel::ERROR )
264265 ->handler('file_log')
265266 ;
266267
267268 // now passed *all* logs, but only if one log is error or higher
268269 $monolog->handler('file_log')
269270 ->type('stream')
270271 ->path('%kernel.logs_dir%/%kernel.environment%.log')
271- ->level('debug' )
272+ ->level(LogLevel::DEBUG )
272273 ;
273274
274275 // still passed *all* logs, and still only logs error or higher
275276 $monolog->handler('syslog_handler')
276277 ->type('syslog')
277- ->level('error' )
278+ ->level(LogLevel::ERROR )
278279 ;
279280 };
280281
281- Now, if even one log entry has an ``error `` level or higher, then *all * log entries
282+ Now, if even one log entry has an ``LogLevel::ERROR `` level or higher, then *all * log entries
282283for that request are saved to a file via the ``file_log `` handler. That means that
283284your log file will contain *all * the details about the problematic request - making
284285debugging much easier!
@@ -349,13 +350,14 @@ option of your handler to ``rotating_file``:
349350 .. code-block :: php
350351
351352 // config/packages/prod/monolog.php
353+ use Psr\Log\LogLevel;
352354 use Symfony\Config\MonologConfig;
353355
354356 return static function (MonologConfig $monolog) {
355357 $monolog->handler('main')
356358 ->type('rotating_file')
357359 ->path('%kernel.logs_dir%/%kernel.environment%.log')
358- ->level('debug' )
360+ ->level(LogLevel::DEBUG )
359361 // max number of log files to keep
360362 // defaults to zero, which means infinite files
361363 ->maxFiles(10);
0 commit comments