10000 minor #7026 Added information about injecting a logger to a service (… · matthieu88160/symfony-docs@018b326 · GitHub
[go: up one dir, main page]

Skip to content

Commit 018b326

Browse files
committed
minor symfony#7026 Added information about injecting a logger to a service (hiddewie, javiereguiluz)
This PR was merged into the 2.7 branch. Discussion ---------- Added information about injecting a logger to a service Issue symfony#7011. I've added a small piece about injecting a logger to a service. However, the separate page about processors seems quite clear to me, also about the DI tags. Commits ------- a500ff3 Proposed a minor reword c8992e6 Added information about injecting a logger to your service
2 parents 967eea7 + a500ff3 commit 018b326

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

logging.rst

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -308,6 +308,15 @@ option of your handler to ``rotating_file``:
308308
),
309309
));
310310
311+
Using a Logger inside a Service
312+
-------------------------------
313+
314+
To use a logger in your own services, add the ``@logger`` service as an argument
315+
of those services. If you want to use a pre-configured logger which uses a
316+
specific channel (``app`` by default), use the ``monolog.logger`` tag with the
317+
``channel`` property as explained in the
318+
:ref:`Dependency Injection reference <dic_tags-monolog>`.
319+
311320
Adding extra Data to each Log (e.g. a unique request token)
312321
-----------------------------------------------------------
313322

0 commit comments

Comments
 (0)
0