Skip to content

Instantly share code, notes, and snippets.

@durka
Created December 12, 2017 21:01
Show Gist options
  • Save durka/79d62fbc3b1688e998610429b0fa60bf to your computer and use it in GitHub Desktop.
Save durka/79d62fbc3b1688e998610429b0fa60bf to your computer and use it in GitHub Desktop.
extern crate failure;
use failure::Error;
use failure::Fail;
use failure::ResultExt;
fn logging() -> Result<(), Error> {
let log_level = env::var("LOG_LEVEL")
.unwrap_or_else(|e| match e {
VarError::NotPresent => "".to_owned(),
s @ VarError::NotUnicode(_) => s.downcast::<VarError>().context("'LOG_LEVEL' not UTF-8
compatible!")?
});
}
fn main() {
logging().unwrap();
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment