Justin Grote
Explore posts from serversMicrosoft.Extensions.Logging dynamic log level?
Hello,
I am working on a LSP Server that uses the omnisharp LSP, which uses MEL for logging. I would like the ability for someone to change the logging level in the client (e.g. vscode) and have the logging level update to the requested level of verbosity. From what I can find, this is amazingly, not part of MEL design, and the recommended way to do this is in a downstream provider that supports it, such as N4Log, etc. but unfortunately one of my log providers is at the MEL provider level (provided by onmisharp), and I don't want to reimplement it at the downstream provider level.
I was looking at how
SetMinimumLevel
works and it seems to register an option that configs the logs, I was thinking maybe it's possible? The DI is such a rats nest of non-type-resolved injections I have no idea where such an option is being referenced, and if it makes a copy so that changes are immutable or if it is a reference so changes would reflect to downstream providers, thus making dynamic changes possible.
Is this a crazy idea or is there prior art for this? Seems like it would be a fairly common request/issue. Thanks all!
Reference: https://stackoverflow.com/questions/70688658/changing-net-minimum-log-level-programmatically3 replies