From e986fbeabc75fd668de656c316f40362f3a4db47 Mon Sep 17 00:00:00 2001 From: Matthias Beyer Date: Sun, 17 Sep 2017 13:43:09 +0200 Subject: [PATCH] Add debugging output --- bin/core/imag-tag/src/main.rs | 24 ++++++++++++++++++------ 1 file changed, 18 insertions(+), 6 deletions(-) diff --git a/bin/core/imag-tag/src/main.rs b/bin/core/imag-tag/src/main.rs index ff2c180c..de9bc0f7 100644 --- a/bin/core/imag-tag/src/main.rs +++ b/bin/core/imag-tag/src/main.rs @@ -48,6 +48,7 @@ use libimagrt::setup::generate_runtime_setup; use libimagentrytag::tagable::Tagable; use libimagentrytag::tag::Tag; use libimagerror::trace::{trace_error, trace_error_exit}; +use libimagerror::trace::MapErrTrace; use libimagstore::storeid::StoreId; use libimagutil::warn_exit::warn_exit; @@ -97,16 +98,24 @@ fn alter(rt: &Runtime, id: PathBuf, add: Option>, rem: Option> match rt.store().get(path) { Ok(Some(mut e)) => { + debug!("Entry header now = {:?}", e.get_header()); + add.map(|tags| { - for tag in tags { - debug!("Adding tag '{:?}'", tag); - if let Err(e) = e.add_tag(tag) { - trace_error(&e); + debug!("Adding tags = '{:?}'", tags); + for tag in tags { + debug!("Adding tag '{:?}'", tag); + if let Err(e) = e.add_tag(tag) { + trace_error(&e); + } else { + debug!("Adding tag worked"); + } } - } - }); // it is okay to ignore a None here + }); // it is okay to ignore a None here + + debug!("Entry header now = {:?}", e.get_header()); rem.map(|tags| { + debug!("Removing tags = '{:?}'", tags); for tag in tags { debug!("Removing tag '{:?}'", tag); if let Err(e) = e.remove_tag(tag) { @@ -114,6 +123,9 @@ fn alter(rt: &Runtime, id: PathBuf, add: Option>, rem: Option> } } }); // it is okay to ignore a None here + + debug!("Entry header now = {:?}", e.get_header()); + }, Ok(None) => {