From 10a7049639136cdcce0fad2209e631a21d00b595 Mon Sep 17 00:00:00 2001 From: Matthias Beyer Date: Sun, 1 Mar 2020 19:10:17 +0100 Subject: Add more trace output for Viewer implementation Signed-off-by: Matthias Beyer --- bin/domain/imag-todo/src/lib.rs | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/bin/domain/imag-todo/src/lib.rs b/bin/domain/imag-todo/src/lib.rs index cc17a1db..42f9baeb 100644 --- a/bin/domain/imag-todo/src/lib.rs +++ b/bin/domain/imag-todo/src/lib.rs @@ -254,6 +254,8 @@ fn list_todos(rt: &Runtime, matcher: &StatusMatcher, show_hidden: bool) -> Resul { use libimagentryview::error::Error as E; + trace!("Viewing entry: {}", entry.get_location()); + if !entry.is_todo().map_err(E::from)? { return Err(format_err!("Not a Todo: {}", entry.get_location())).map_err(E::from); } @@ -267,10 +269,12 @@ fn list_todos(rt: &Runtime, matcher: &StatusMatcher, show_hidden: bool) -> Resul .unwrap_or(""); if !self.details { - writeln!(sink, "{uuid} - {status} : {first_line}", + let r = writeln!(sink, "{uuid} - {status} : {first_line}", uuid = uuid, status = status, - first_line = first_line) + first_line = first_line); + trace!("Viewing entry result: {:?}", r); + r } else { let sched = util::get_dt_str(entry.get_scheduled(), "Not scheduled")?; let hidden = util::get_dt_str(entry.get_hidden(), "Not hidden")?; @@ -278,14 +282,17 @@ fn list_todos(rt: &Runtime, matcher: &StatusMatcher, show_hidden: bool) -> Resul let priority = entry.get_priority().map_err(E::from)?.map(|p| p.as_str().to_string()) .unwrap_or_else(|| "No prio".to_string()); - writeln!(sink, "{uuid} - {status} - {sched} - {hidden} - {due} - {prio}: {first_line}", + let r = writeln!(sink, "{uuid} - {status} - {sched} - {hidden} - {due} - {prio}: {first_line}", uuid = uuid, status = status, sched = sched, hidden = hidden, due = due, prio = priority, - first_line = first_line) + first_line = first_line); + + trace!("Viewing entry result: {:?}", r); + r } .map_err(libimagentryview::error::Error::from) } -- cgit v1.2.3