I’m writing a plugin (Kotlin) which uses a 3rd party library (also Kotlin). This library makes use of logger.error
calls (via io.github.oshai.kotlinlogging.KotlinLogging
). The IDE treats these error logs as a high severity, and shows them in the little notification bubble in the bottom right, offering the user the option to submit a report.
I want to suppress this. I don’t want to disable the logs for this 3rd party library, as the logs may be useful for debugging. But the only thing which should be presented to the user are logs from my own plugin, as my own plugin is the one that is aware of the impact of logging with error
severity. Everything else should just be logged, and not presented to the user.
I can think of a few solutions to this, but none of them are pretty. I figure this can’t be that obscure of an issue, and that there’s likely some idiomatic approach to the problem.
So how can I address this?
My current not-pretty solution is to set up a MessagePoolListener
, and create an override for beforeEntryAdded
to suppress the messages. This is a fairly heavy approach. But the main issue is that the logs I’m trying to suppress are CancellationException
s, which don’t contain a stack trace. The messages also strip the class name from the log entry. So I have no way to identify the source of the log entry. All I can do is suppress every single CancellationException
, no matter where it came from.