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

Adds a new constructor and init functions for custom env vars. #25

Merged
merged 1 commit into from
Oct 13, 2017
Merged

Adds a new constructor and init functions for custom env vars. #25

merged 1 commit into from
Oct 13, 2017

Conversation

jimmycuadra
Copy link
Contributor

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.

I also changed the docs for the init functions slightly to make it clearer what the difference is between them all when reading the docs for the crate root.

I haven't added any new tests, but I'd be happy to if desired. Let me know if there is a preferred way of working with environment variables to keep tests deterministic.

Refs #23
Refs rust-lang/log#83

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
@KodrAus
Copy link
Collaborator

KodrAus commented Oct 13, 2017

Thanks again @jimmycuadra!

I think this looks good. There probably isn't a whole lot of value testing the environment vars, since they just hand off to parse where the real work happens.

@KodrAus KodrAus merged commit 3d1afe8 into rust-cli:master Oct 13, 2017
@jimmycuadra jimmycuadra deleted the from-env branch October 13, 2017 11:36
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

Successfully merging this pull request may close these issues.

2 participants