Skip to content

Conversation

HypeMC
Copy link
Contributor

@HypeMC HypeMC commented Sep 18, 2025

Description

Currently, the constructor only accepts integers as the log level, e.g. by using the Monolog\Logger constants:

services:
  Sentry\SentryBundle\Monolog\LogsHandler:
    arguments:
      - !php/const Monolog\Logger::INFO

This, however, isn't very flexible, especially since the Monolog constants are deprecated.
This PR expands the accepted types to also allow strings or the Monolog Level enum, like other handlers:

services:
  Sentry\SentryBundle\Monolog\LogsHandler:
    arguments:
      - 'info'
# or using PSR constants
services:
  Sentry\SentryBundle\Monolog\LogsHandler:
    arguments:
      - !php/const Psr\Log\LogLevel::INFO
// or via PHP config
$container->services()
    ->set(\Sentry\SentryBundle\Monolog\LogsHandler::class)
    ->args([\Monolog\Level::Info]);

<code><![CDATA[isMasterRequest]]></code>
</UndefinedMethod>
</file>
<file src="src/Monolog/LogsHandler.php">
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Seems to be a bug in Psalm when using const on enums: https://psalm.dev/r/a6f9298b82

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant