-
-
Notifications
You must be signed in to change notification settings - Fork 17
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat(backend): allow to set log level via config file #182
Conversation
d53ccae
to
11f60cc
Compare
Making use of: https://docs.rs/simple_logger/2.1.0/simple_logger/fn.init_with_level.html If the "RUST_LOG" environment variable is set, it overrides the value from the config file, which makes testing and debugging easier without the need to adjust the config file and hence without affecting the default service. Signed-off-by: MichaIng <micha@dietpi.com>
11f60cc
to
be3aea9
Compare
@ravenclaw900
Not sure how to convert them best. Converting the env var + default both into Best would be actually to pass it as Otherwise we could simply ignore the environment variable for now, but actually I like the option to use it for quick debugging 😉. |
Have `simple_logger` do the environment variable parsing for us, so that all we have to worry about is the config file
The problem was that you were trying to run |
Ah, so a simply I'll test this tomorrow. |
Also, once I figure some things out with |
There should be exclusions for login password and secret for security reasons, but otherwise sounds good. |
Probably no performance difference, but doesn't allocate unless necessary
This reverts commit 46dddd3.
Signed-off-by: MichaIng <micha@dietpi.com>
If the "RUST_LOG" environment variable is set, it overrides the value from the config file, which makes testing and debugging easier without the need to adjust the config file and hence without affecting the default service.
Also the conversion from String to toml::Value to str back to String, then in
main.rs
from String back to str to log::Level somehow looks like an unnecessary loop. Fascinating that searching around for an hour or so I couldn't find a single example of how a String or str is converted into a log::Level or alternatively log::LevelFilter directly. Probably we can also store the environment valuable || config value || default also directly as log::Level?