From 6f33e4e3223973d5fcd701eed6dfea0ffd4e6d32 Mon Sep 17 00:00:00 2001 From: Matthias Beyer Date: Tue, 20 Mar 2018 16:42:52 +0100 Subject: [PATCH] Add debug output --- lib/entry/libimagentryref/src/generators/mod.rs | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/lib/entry/libimagentryref/src/generators/mod.rs b/lib/entry/libimagentryref/src/generators/mod.rs index 427ebaaa..204ae081 100644 --- a/lib/entry/libimagentryref/src/generators/mod.rs +++ b/lib/entry/libimagentryref/src/generators/mod.rs @@ -91,6 +91,7 @@ macro_rules! make_unique_ref_path_generator { } fn unique_hash>(path: A) -> Result { + debug!("Making unique hash for path: {:?}", path.as_ref()); $impl(path) } @@ -135,7 +136,8 @@ macro_rules! make_unique_ref_path_generator { $collectionname } - fn unique_hash>(path: A) -> Result { + fn unique_hash>(path: A) -> ::std::result::Result { + debug!("Making unique hash for path: {:?}", path.as_ref()); $impl(path) } @@ -198,6 +200,7 @@ macro_rules! make_sha_mod { /// Function which can be used by a wrapping UniqueRefPathGenerator to hash only N bytes. pub fn hash_n_bytes>(path: A, n: usize) -> Result { + debug!("Opening '{}' for hashing", path.as_ref().display()); OpenOptions::new() .read(true) .write(false) @@ -233,8 +236,13 @@ macro_rules! make_sha_mod { make_sha_mod! { sha1, Sha1, |buffer: String| { let mut hasher = ::crypto::sha1::Sha1::new(); + + trace!("Hashing: '{:?}'", buffer); hasher.input_str(&buffer); - Ok(String::from(hasher.result_str())) + let res = hasher.result_str(); + trace!("Hash => '{:?}'", res); + + Ok(String::from(res)) } }