Add debugging output

This commit is contained in:
Matthias Beyer 2015-12-04 17:15:45 +01:00
parent 2b21d1cb47
commit 08fa8f8655
2 changed files with 6 additions and 0 deletions

View file

@ -123,6 +123,7 @@ fn get_filtered_files_from_backend<'a>(module: &'a Module,
env.bk.iter_files(module, &parser) env.bk.iter_files(module, &parser)
.map(|files| { .map(|files| {
let f = files.filter(|file| { let f = files.filter(|file| {
debug!("Backend returns file: {:?}", file);
if tags.len() != 0 { if tags.len() != 0 {
debug!("Checking tags of: {:?}", file.id()); debug!("Checking tags of: {:?}", file.id());
get_tags_from_header(&file.header()).iter() get_tags_from_header(&file.header()).iter()
@ -138,6 +139,7 @@ fn get_filtered_files_from_backend<'a>(module: &'a Module,
}).collect::<Vec<File>>(); }).collect::<Vec<File>>();
f.into_iter() f.into_iter()
}).map_err(|e| { }).map_err(|e| {
debug!("Error from Backend: {:?}", e);
let mut merr = ModuleError::new("Could not filter files"); let mut merr = ModuleError::new("Could not filter files");
merr.caused_by = Some(Box::new(e)); merr.caused_by = Some(Box::new(e));
merr merr

View file

@ -56,12 +56,14 @@ impl StorageBackend {
{ {
glob(&self.prefix_of_files_for_module(m)[..]) glob(&self.prefix_of_files_for_module(m)[..])
.and_then(|globlist| { .and_then(|globlist| {
debug!("Iterating over globlist");
Ok(globlist.filter_map(Result::ok) Ok(globlist.filter_map(Result::ok)
.map(|pbuf| FileID::from(&pbuf)) .map(|pbuf| FileID::from(&pbuf))
.collect::<Vec<FileID>>() .collect::<Vec<FileID>>()
.into_iter()) .into_iter())
}) })
.map_err(|e| { .map_err(|e| {
debug!("glob() returned error: {:?}", e);
let serr = StorageBackendError::new( let serr = StorageBackendError::new(
"iter_ids()", "iter_ids()",
"Cannot iter on file ids", "Cannot iter on file ids",
@ -78,6 +80,8 @@ impl StorageBackend {
{ {
self.iter_ids(m) self.iter_ids(m)
.and_then(|ids| { .and_then(|ids| {
debug!("Iterating ids and building files from them");
debug!(" number of ids = {}", ids.len());
Ok(ids.filter_map(|id| self.get_file_by_id(m, &id, p)) Ok(ids.filter_map(|id| self.get_file_by_id(m, &id, p))
.collect::<Vec<File>>() .collect::<Vec<File>>()
.into_iter()) .into_iter())