diff --git a/arx/src/main.rs b/arx/src/main.rs index 04b1e88..21d08e1 100644 --- a/arx/src/main.rs +++ b/arx/src/main.rs @@ -85,6 +85,15 @@ fn configure_log(verbose: u8) { _ => log::LevelFilter::Trace, }, ) + .filter_module( + "libarx", + match verbose { + 0 => log::LevelFilter::Warn, + 1 => log::LevelFilter::Info, + 2 => log::LevelFilter::Debug, + _ => log::LevelFilter::Trace, + }, + ) .format_module_path(false) .format_timestamp(None) .init(); diff --git a/arx/tests/utils/mod.rs b/arx/tests/utils/mod.rs index 01e632f..7f16c19 100644 --- a/arx/tests/utils/mod.rs +++ b/arx/tests/utils/mod.rs @@ -393,7 +393,7 @@ macro_rules! join { }; (@init, $first:expr, $($args:tt),+) => { { - let mut path:PathBuf = AsRef::::as_ref(&$first).to_path_buf(); + let mut path:std::path::PathBuf = std::convert::AsRef::::as_ref(&$first).to_path_buf(); join!(@append, path, $($args),+); path } diff --git a/libarx/src/create/entry_store_creator.rs b/libarx/src/create/entry_store_creator.rs index 64ba1fe..05f1b38 100644 --- a/libarx/src/create/entry_store_creator.rs +++ b/libarx/src/create/entry_store_creator.rs @@ -85,9 +85,10 @@ impl DirEntry { let mut write_children = self.children.try_write().unwrap(); match write_children.get_mut(component.as_str()).unwrap() { DirOrFile::Dir(e) => e.add(entry, components, entry_store), - DirOrFile::File(_) => Err(IncoherentStructure( - "Cannot add a entry to something which is not a directory".into(), - ) + DirOrFile::File(_) => Err(IncoherentStructure(format!( + "Adding {}, cannot add a entry to something which is not a directory", + entry.path() + )) .into()), } } @@ -172,9 +173,10 @@ impl DirEntry { match self.children.try_read().unwrap().get(entry_name) { Some(DirOrFile::Dir(_)) => return Ok(()), Some(DirOrFile::File(_)) => { - return Err(IncoherentStructure( - "Cannot add a dir when file or link already exists".into(), - ) + return Err(IncoherentStructure(format!( + "Adding {}, cannot add a dir when file or link already exists", + entry.path() + )) .into()) } None => {} @@ -208,9 +210,10 @@ impl DirEntry { } EntryKind::File(size, content_address) => { if self.children.try_read().unwrap().contains_key(entry_name) { - return Err(IncoherentStructure( - "Cannot add a file when one already exists".into(), - ) + return Err(IncoherentStructure(format!( + "Adding {}, cannot add a file when one already exists", + entry.path() + )) .into()); } values.insert(Property::Content, jbk::Value::Content(content_address)); @@ -229,9 +232,10 @@ impl DirEntry { } EntryKind::Link(target) => { if self.children.try_read().unwrap().contains_key(entry_name) { - return Err(IncoherentStructure( - "Cannot add a link when one already exists".into(), - ) + return Err(IncoherentStructure(format!( + "Adding {}, cannot add a link when one already exists", + entry.path() + )) .into()); } values.insert( diff --git a/python/src/entry.rs b/python/src/entry.rs index 17386bc..9ebb413 100644 --- a/python/src/entry.rs +++ b/python/src/entry.rs @@ -160,7 +160,7 @@ impl Entry { /// Get the link target of the link entry. /// /// Raise an exception if entry is not a link. - fn get_target(&self) -> PyResult> { + fn get_target(&self) -> PyResult> { match &self.entry { arx::Entry::Link(l) => Ok(l.target().into()), _ => Err(PyTypeError::new_err("Not a link")),