Skip to content

Commit 1ec5ca2

Browse files
committed
Merge branch '5.4' into 6.4
* 5.4: [DependencyInjection] Add readonly statement to the Lazy Services docs [Logger] Using LogLevel `const`s, Part 2
2 parents 7789dfb + 1c029ca commit 1ec5ca2

File tree

2 files changed

+9
-7
lines changed

2 files changed

+9
-7
lines changed

logging.rst

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -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
283284
for that request are saved to a file via the ``file_log`` handler. That means that
284285
your log file will contain *all* the details about the problematic request - making
285286
debugging 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);

service_container/lazy_services.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ until you interact with the proxy in some way.
2323

2424
.. caution::
2525

26-
Lazy services do not support `final`_ classes, but you can use
26+
Lazy services do not support `final`_ or ``readonly`` classes, but you can use
2727
`Interface Proxifying`_ to work around this limitation.
2828

2929
In PHP versions prior to 8.0 lazy services do not support parameters with

0 commit comments

Comments
 (0)