Skip to content
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

Change environment variable name. #83

Closed
quadrupleslap opened this issue May 22, 2016 · 3 comments
Closed

Change environment variable name. #83

quadrupleslap opened this issue May 22, 2016 · 3 comments

Comments

@quadrupleslap
Copy link

quadrupleslap commented May 22, 2016

For env_logger, maybe keep the default as RUST_LOG and allow the users to change it as a config option? For example, I might want people to use MC_LOG to change the log level of my Minecraft clone.

@xetra11
Copy link

xetra11 commented Aug 26, 2016

Yea that would be nice!
Because I want people who use my library use a library specific env variable to active the logging like "RR_LOG"

@dtolnay
Copy link
Member

dtolnay commented May 24, 2017

The workaround for now is:

let mut lb = env_logger::LogBuilder::new();
if let Ok(log_config) = env::var("MC_LOG") {
    lb.parse(&log_config);
}
lb.init()

@sfackler
Copy link
Member

env_logger has moved out of tree.

KodrAus pushed a commit to rust-cli/env_logger that referenced this issue Oct 13, 2017
Three new methods/functions that are like existing ones, but allow you
to specify the name of the environment variable to parse:

* `Logger::from_env`, which is like `Logger::new`.
* `init_from_env`, which is like `init`.
* `try_init_from_env`, which is like `try_init`.

Refs #23
Refs rust-lang/log#83
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants