@@ -164,7 +164,7 @@ to write logs using the :phpfunction:`syslog` function:
164164 ->type('stream')
165165 // log to var/logs/(environment).log
166166 ->path('%kernel.logs_dir%/%kernel.environment%.log')
167- // log *all* messages (debug is lowest level)
167+ // log *all* messages (LogLevel::DEBUG is lowest level)
168168 ->level(LogLevel::DEBUG);
169169
170170 $monolog->handler('syslog_handler')
@@ -255,31 +255,32 @@ one of the messages reaches an ``action_level``. Take this example:
255255 .. code-block :: php
256256
257257 // config/packages/prod/monolog.php
258+ use Psr\Log\LogLevel;
258259 use Symfony\Config\MonologConfig;
259260
260261 return static function (MonologConfig $monolog): void {
261262 $monolog->handler('filter_for_errors')
262263 ->type('fingers_crossed')
263264 // if *one* log is error or higher, pass *all* to file_log
264- ->actionLevel('error' )
265+ ->actionLevel(LogLevel::ERROR )
265266 ->handler('file_log')
266267 ;
267268
268269 // now passed *all* logs, but only if one log is error or higher
269270 $monolog->handler('file_log')
270271 ->type('stream')
271272 ->path('%kernel.logs_dir%/%kernel.environment%.log')
272- ->level('debug' )
273+ ->level(LogLevel::DEBUG )
273274 ;
274275
275276 // still passed *all* logs, and still only logs error or higher
276277 $monolog->handler('syslog_handler')
277278 ->type('syslog')
278- ->level('error' )
279+ ->level(LogLevel::ERROR )
279280 ;
280281 };
281282
282- Now, if even one log entry has an ``error `` level or higher, then *all * log entries
283+ Now, if even one log entry has an ``LogLevel::ERROR `` level or higher, then *all * log entries
283284for that request are saved to a file via the ``file_log `` handler. That means that
284285your log file will contain *all * the details about the problematic request - making
285286debugging much easier!
@@ -350,13 +351,14 @@ option of your handler to ``rotating_file``:
350351 .. code-block :: php
351352
352353 // config/packages/prod/monolog.php
354+ use Psr\Log\LogLevel;
353355 use Symfony\Config\MonologConfig;
354356
355357 return static function (MonologConfig $monolog): void {
356358 $monolog->handler('main')
357359 ->type('rotating_file')
358360 ->path('%kernel.logs_dir%/%kernel.environment%.log')
359- ->level('debug' )
361+ ->level(LogLevel::DEBUG )
360362 // max number of log files to keep
361363 // defaults to zero, which means infinite files
362364 ->maxFiles(10);
0 commit comments