Problem/Motivation
Currently DrupalConsoleLogger only accepts log messages with the RFC integer log levels. It then translates these levels to the PSR string log levels and passes the message to the console logger.
Third-party libraries will typically emit logs using the PSR string log levels. It would be much easier to plug these libraries in to the logger.console service for debug logging purposes if DrupalConsoleLogger would also accept log messages with the PSR string log levels.
In comparison, Drush\Log\DrushLog accepts both RFC integer and PSR string log levels.
Steps to reproduce
Proposed resolution
Accept both RFC integer and PSR string log levels, passing string levels thru to Symfony\Component\Console\Logger\ConsoleLogger. Unrecognized integer levels will cause DrupalConsoleLogger to throw Psr\Log\InvalidArgumentException, while unrecognized string levels will cause Symfony\Component\Console\Logger\ConsoleLogger to throw Psr\Log\InvalidArgumentException.
Remaining tasks
User interface changes
Introduced terminology
API changes
Data model changes
Release notes snippet
Issue fork drupal-3622450
Show commands
Start within a Git clone of the project using the version control instructions.
Or, if you do not have SSH keys set up on git.drupalcode.org:
Comments
Comment #3
mfbComment #4
mfbComment #5
ironnuts commentedComment #6
ironnuts commentedThis is more impactful that https://www.drupal.org/project/drupal/issues/3622446. But it looks like BC is covered as it seems you are adding extra compatiblity not altering existing compatibility with 3rd party libraries that might be using the current implentation. For that reason I think no change record is required.
I have read through the code and LGTM. The pipeline is green. Test-only test fails on the new test code https://git.drupalcode.org/issue/drupal-3622450/-/jobs/12156040 RTBTC.
Comment #7
ironnuts commented