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

Conversation

Projects
None yet
2 participants
@jimmycuadra
Copy link
Contributor

jimmycuadra commented Oct 12, 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.

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-nursery/log#83

Adds a new constructor and init functions for custom env vars.
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-nursery/log#83
@KodrAus

This comment has been minimized.

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 sebasmagri:master Oct 13, 2017

1 check passed

continuous-integration/travis-ci/pr The Travis CI build passed
Details

@jimmycuadra jimmycuadra deleted the jimmycuadra:from-env branch Oct 13, 2017

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.