Use Monolog log level in Sentry\Monolog::isHandling
Problem Statement
The current implementation uses the converted Sentry\Logs\LogLevel in Sentry\Monolog::isHandling. This removes the possibility to differentiate between some log levels, like INFO and NOTICE. They get merged to LogLevel::Info. This makes it impossible to only send Notice-Logs to Sentry.
It's also very confusing to suddenly see INFO logs in Sentry after configuring NOTICE.
It also affects CRITICAL, ALERT and EMERGENCY.
Solution Brainstorm
The method Sentry\Monolog::isHandling should check against the Monolog level, instead of the Sentry level to decide if a log entry gets processed.
Hi @Nomexus! Sentry only supports 6 different log levels (same as OTel) compared to Monolog, which supports 8. Because of this we had to merge some log levels together, otherwise we would have to drop some logs if they had an unsupported log level, which I believe would be the worse outcome.
I'm closing this issue as I believe that it's not actionable for us, but feel free to reply if you have suggestions. Please bear in mind that it's not possible to change or increase the number of log levels in Sentry itself as they strictly follow OTel.
It occurred to me that I misunderstood the problem and I see that your issue is valid. I will re-open it and will have a look!
It occurred to me that I misunderstood the problem and I see that your issue is valid. I will re-open it and will have a look!
Thank you! I think the conversion only needs to happen in Sentry\Monolog\LogsHandler::handle