Make trace() output a bit nicer

This commit is contained in:
Matthias Beyer 2016-04-21 16:36:13 +02:00
parent bd2f7bc616
commit ad4e73399f

View file

@ -55,7 +55,7 @@ fn print_trace_maxdepth(idx: u64, e: &Error, max: u64) -> Option<&Error> {
} else { } else {
write!(stderr(), "\n").ok(); write!(stderr(), "\n").ok();
} }
write!(stderr(), "Error {:>4} : {}", idx, e.description()).ok(); write!(stderr(), "ERROR[{:>4}]: {}", idx, e.description()).ok();
e.cause() e.cause()
} }
@ -65,7 +65,7 @@ fn count_error_causes(e: &Error) -> u64 {
} }
fn print_trace_dbg(idx: u64, e: &Error) { fn print_trace_dbg(idx: u64, e: &Error) {
debug!("Error {:>4} : {}", idx, e.description()); debug!("ERROR[{:>4}]: {}", idx, e.description());
if e.cause().is_some() { if e.cause().is_some() {
debug!(" -- caused by:"); debug!(" -- caused by:");
print_trace_dbg(idx + 1, e.cause().unwrap()); print_trace_dbg(idx + 1, e.cause().unwrap());