Microsoft.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-programmatically
Stack Overflow
Changing .NET Minimum Log Level programmatically
Using Microsoft.Extensions.Logging, let be the log initialization (F#): let myLogger = LoggerFactory .Create(fun builder -> builder .AddSimpleConsole() ...
1 Reply
Justin Grote
Justin GroteOP3w ago
The solution there uses reflection which seems a really icky way to go about it Ive seen some solutions that use the ASP providers like appsettings.json and modifying those log levels take effect in real time, so it seems like something similar could maybe be done but via a method rather than a file watcher
Want results from more Discord servers?
Add your server