diff options
author | boasting-squirrel <boasting.squirrel@gmail.com> | 2019-03-13 18:30:54 +0000 |
---|---|---|
committer | boasting-squirrel <boasting.squirrel@gmail.com> | 2019-03-13 18:30:54 +0000 |
commit | 17ef61a126e81c9ecfd1ebdd89537e854a06cae6 (patch) | |
tree | 24669a4d54650bd6b114012d3b476852ea4b9210 /src/errors.rs | |
parent | upgraded to libflate 0.1.21 (diff) | |
download | miniserve-17ef61a126e81c9ecfd1ebdd89537e854a06cae6.tar.gz miniserve-17ef61a126e81c9ecfd1ebdd89537e854a06cae6.zip |
Switched to standard Rust logging system
Diffstat (limited to 'src/errors.rs')
-rw-r--r-- | src/errors.rs | 15 |
1 files changed, 3 insertions, 12 deletions
diff --git a/src/errors.rs b/src/errors.rs index 8cfedff..a9b6c74 100644 --- a/src/errors.rs +++ b/src/errors.rs @@ -1,6 +1,5 @@ use failure::{Backtrace, Context, Fail}; use std::fmt::{self, Debug, Display}; -use yansi::{Color, Paint}; /// Kinds of errors which might happen during the generation of an archive #[derive(Debug, Fail)] @@ -22,18 +21,10 @@ pub enum CompressionErrorKind { /// Prints the full chain of error, up to the root cause. /// If RUST_BACKTRACE is set to 1, also prints the backtrace for each error pub fn print_error_chain(err: CompressionError) { - println!( - "{error} {err}", - error = Paint::red("error:").bold(), - err = Paint::white(&err).bold() - ); + log::error!("{}", &err); print_backtrace(&err); for cause in Fail::iter_causes(&err) { - println!( - "{} {}", - Color::RGB(255, 192, 0).paint("caused by:").to_string(), - cause - ); + log::error!("caused by: {}", cause); print_backtrace(cause); } } @@ -44,7 +35,7 @@ fn print_backtrace(err: &dyn Fail) { if let Some(backtrace) = err.backtrace() { let backtrace = backtrace.to_string(); if backtrace != "" { - println!("{}", backtrace); + log::error!("{}", backtrace); } } } |