more consistent logging

This commit is contained in:
Cyryl Płotnicki 2021-02-06 16:34:42 +00:00
parent 259bcdaa08
commit 1d29b33f90
3 changed files with 3 additions and 2 deletions

View file

@ -43,6 +43,7 @@ impl RepositoryItem {
let original_source_path = Path::new(self.original_source_path()); let original_source_path = Path::new(self.original_source_path());
let source_path_relative = original_source_path.strip_prefix("/")?; let source_path_relative = original_source_path.strip_prefix("/")?;
let source_path_relative = source_path_relative.to_string_lossy(); let source_path_relative = source_path_relative.to_string_lossy();
let target_path = save_to.join(&source_path_relative)?; let target_path = save_to.join(&source_path_relative)?;
let parent = target_path let parent = target_path
.parent() .parent()
@ -54,6 +55,7 @@ impl RepositoryItem {
} }
self.absolute_path.copy_file(&target_path)?; self.absolute_path.copy_file(&target_path)?;
log::debug!("[{}] saved data to {}", getpid(), target_path.as_str());
Ok(()) Ok(())
} }

View file

@ -172,7 +172,7 @@ pub mod in_memory {
fn assert_target_file_contents(restored_path: &VfsPath, expected_contents: &[u8]) -> Result<()> { fn assert_target_file_contents(restored_path: &VfsPath, expected_contents: &[u8]) -> Result<()> {
let mut actual_contents = vec![]; let mut actual_contents = vec![];
assert!(restored_path.exists(), "Expected '{:?}' to be there", restored_path); assert!(restored_path.exists(), "expected '{}' to be there", restored_path.as_str());
restored_path.open_file()?.read_to_end(&mut actual_contents)?; restored_path.open_file()?.read_to_end(&mut actual_contents)?;
assert_eq!(expected_contents, actual_contents); assert_eq!(expected_contents, actual_contents);
Ok(()) Ok(())

View file

@ -20,7 +20,6 @@ impl TestSource {
let path = self.file_path(filename)?; let path = self.file_path(filename)?;
let mut file = path.create_file()?; let mut file = path.create_file()?;
file.write_all(bytes)?; file.write_all(bytes)?;
dbg!(format!("wrote bytes under {}", filename));
Ok(()) Ok(())
} }