diff --git a/libimagstore/src/store.rs b/libimagstore/src/store.rs index e8fbbb98..f7c0ab64 100644 --- a/libimagstore/src/store.rs +++ b/libimagstore/src/store.rs @@ -103,18 +103,23 @@ impl Store { pub fn new(location: PathBuf) -> Result { use std::fs::create_dir_all; + debug!("Building new Store object"); if !location.exists() { + debug!("Creating store path"); let c = create_dir_all(location.clone()); if c.is_err() { + debug!("Failed"); return Err(StoreError::new(StoreErrorKind::StorePathCreate, Some(Box::new(c.err().unwrap())))); } } else { if location.is_file() { + debug!("Store path exists as file"); return Err(StoreError::new(StoreErrorKind::StorePathExists, None)); } } + debug!("Store building succeeded"); Ok(Store { location: location, entries: Arc::new(RwLock::new(HashMap::new())), @@ -218,6 +223,7 @@ impl Drop for Store { * TODO: Unlock them */ fn drop(&mut self) { + debug!("Dropping store"); } } @@ -400,6 +406,7 @@ impl Entry { } pub fn from_str(loc: StoreId, s: &str) -> Result { + debug!("Building entry from string"); let re = Regex::new(r"(?smx) ^---$ (?P
.*) # Header @@ -422,6 +429,7 @@ impl Entry { return Err(StoreError::new(StoreErrorKind::MalformedEntry, None)); } + debug!("Header and content found. Yay! Building Entry object now"); Ok(Entry { location: loc, header: try!(EntryHeader::parse(header.unwrap())),