You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Currently, I don't see a nice way to change logging levels dynamically. (Or is there?). It is not very friendly with log::set_max_level_filter either to able to make even small changes.
Would be nice to be able to make small changes if not full reparse during runtime. It becomes extremely helpful in server environments to be able to to that.
The text was updated successfully, but these errors were encountered:
I took a jab at adding support for this and have come up with two prototypes:
Non breaking change: Added an RwLock around the filter field of the Logger struct. This approach is simple but there is a read penalty when accessing the filter field anytime something is logged. Code for this approach here
Breaking change: Used generics to create a logger that can change filters at runtime or forgo the ability to change at runtime to avoid the read penalty and remain static (basically how it is now). Code for this approach here
For both prototypes, when the logger is built you can get an instance of a new struct called DynamicLogLevel. It has a check_filter_config method that when called, checks a config file and updates the filter if the levels have changed.
The contents of this config file should follow the same syntax used for the RUST_LOG env var.
My goal is to start the conversation and possibly see if there are better ways to add support for this.
Originally raised in #103
The text was updated successfully, but these errors were encountered: