Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update monolog_console.rst #17927

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 11 additions & 3 deletions logging/monolog_console.rst
Original file line number Diff line number Diff line change
Expand Up @@ -35,17 +35,17 @@ the current log level and the console verbosity.

The example above could then be rewritten as::

// src/Command/YourCommand.php
// src/Command/MyCommand.php
namespace App\Command;

use Psr\Log\LoggerInterface;
use Symfony\Component\Console\Command\Command;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Output\OutputInterface;

class YourCommand extends Command
class MyCommand extends Command
{
private $logger;
private LoggerInterface $logger;

public function __construct(LoggerInterface $logger)
{
Expand All @@ -59,6 +59,14 @@ The example above could then be rewritten as::
}
}

.. tip::

You can also change the log level for a specific command at runtime with:

.. code-block:: terminal

$ LOG_LEVEL=debug php bin/console ...

Depending on the verbosity level that the command is run in and the user's
configuration (see below), these messages may or may not be displayed to
the console. If they are displayed, they are time-stamped and colored appropriately.
Expand Down