Skip to content

Commit 76cf7a2

Browse files
committed
minor #20583 [Logging] Add references to the ConsoleLogger (phansys)
This PR was submitted for the 7.1 branch but it was merged into the 6.4 branch instead. Discussion ---------- [Logging] Add references to the `ConsoleLogger` See symfony/symfony#59527. Commits ------- b9c7139 [Logging] Add references to the `ConsoleLogger`
2 parents 35df8ae + b9c7139 commit 76cf7a2

File tree

1 file changed

+13
-6
lines changed

1 file changed

+13
-6
lines changed

logging.rst

+13-6
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,10 @@
11
Logging
22
=======
33

4-
Symfony comes with a minimalist `PSR-3`_ logger: :class:`Symfony\\Component\\HttpKernel\\Log\\Logger`.
5-
In conformance with `the twelve-factor app methodology`_, it sends messages starting from the
4+
Symfony comes with two minimalist `PSR-3`_ loggers: :class:`Symfony\\Component\\HttpKernel\\Log\\Logger`
5+
for the HTTP context and :class:`Symfony\\Component\\Console\\Logger\\ConsoleLogger` for the
6+
CLI context.
7+
In conformance with `the twelve-factor app methodology`_, they send messages starting from the
68
``WARNING`` level to `stderr`_.
79

810
The minimal log level can be changed by setting the ``SHELL_VERBOSITY`` environment variable:
@@ -17,13 +19,18 @@ The minimal log level can be changed by setting the ``SHELL_VERBOSITY`` environm
1719
========================= =================
1820

1921
The minimum log level, the default output and the log format can also be changed by
20-
passing the appropriate arguments to the constructor of :class:`Symfony\\Component\\HttpKernel\\Log\\Logger`.
21-
To do so, :ref:`override the "logger" service definition <service-psr4-loader>`.
22+
passing the appropriate arguments to the constructor of :class:`Symfony\\Component\\HttpKernel\\Log\\Logger`
23+
and :class:`Symfony\\Component\\Console\\Logger\\ConsoleLogger`.
24+
25+
The :class:`Symfony\\Component\\HttpKernel\\Log\\Logger` class is available through the ``logger`` service.
26+
To pass your configuration, you can :ref:`override the "logger" service definition <service-psr4-loader>`.
27+
28+
For more information about ``ConsoleLogger``, see :doc:`/components/console/logger`.
2229

2330
Logging a Message
2431
-----------------
2532

26-
To log a message, inject the default logger in your controller or service::
33+
To log a message using the ``logger`` service, inject the default logger in your controller or service::
2734

2835
use Psr\Log\LoggerInterface;
2936
// ...
@@ -55,7 +62,7 @@ Adding placeholders to log messages is recommended because:
5562
* It's better for security, because escaping can then be done by the
5663
implementation in a context-aware fashion.
5764

58-
The ``logger`` service has different methods for different logging levels/priorities.
65+
The logger implementations has different methods for different logging levels/priorities.
5966
See `LoggerInterface`_ for a list of all of the methods on the logger.
6067

6168
Monolog

0 commit comments

Comments
 (0)