Skip to content

[Logger] Using LogLevel consts #19670

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

Merged
merged 1 commit into from
Mar 14, 2024
Merged
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
5 changes: 3 additions & 2 deletions logging.rst
Original file line number Diff line number Diff line change
Expand Up @@ -154,6 +154,7 @@ to write logs using the :phpfunction:`syslog` function:
.. code-block:: php

// config/packages/prod/monolog.php
use Psr\Log\LogLevel;
use Symfony\Config\MonologConfig;

return static function (MonologConfig $monolog) {
Expand All @@ -163,12 +164,12 @@ to write logs using the :phpfunction:`syslog` function:
// log to var/logs/(environment).log
->path('%kernel.logs_dir%/%kernel.environment%.log')
// log *all* messages (debug is lowest level)
->level('debug');
->level(LogLevel::DEBUG);

$monolog->handler('syslog_handler')
->type('syslog')
// log error-level messages and higher
->level('error');
->level(LogLevel::ERROR);
};

This defines a *stack* of handlers and each handler is called in the order that it's
Expand Down