Add debugging output

This commit is contained in:
Matthias Beyer 2017-12-03 18:44:35 +01:00
parent 90a4139ede
commit 30e05d21f9

View file

@ -189,14 +189,24 @@ pub mod builder {
} }
let name = try!(self.name.ok_or_else(|| mkerr("name"))); let name = try!(self.name.ok_or_else(|| mkerr("name")));
debug!("Success: Name present");
let dateobj = try!(self.basedate.ok_or_else(|| mkerr("date"))); let dateobj = try!(self.basedate.ok_or_else(|| mkerr("date")));
debug!("Success: Date present");
let recur = try!(self.recurspec.ok_or_else(|| mkerr("recurspec"))); let recur = try!(self.recurspec.ok_or_else(|| mkerr("recurspec")));
debug!("Success: Recurr spec present");
if let Err(e) = ::kairos::parser::parse(&recur) { if let Err(e) = ::kairos::parser::parse(&recur) {
return Err(e).map_err(From::from); return Err(e).map_err(From::from);
} }
let date = date_to_string(&dateobj); let date = date_to_string(&dateobj);
debug!("Success: Date valid");
let comment = self.comment.unwrap_or_else(|| String::new()); let comment = self.comment.unwrap_or_else(|| String::new());
let sid = try!(build_habit_template_sid(&name)); let sid = try!(build_habit_template_sid(&name));
debug!("Creating entry in store for: {:?}", sid);
let mut entry = try!(store.create(sid)); let mut entry = try!(store.create(sid));
try!(entry.get_header_mut().insert("habit.template.name", Value::String(name))); try!(entry.get_header_mut().insert("habit.template.name", Value::String(name)));
@ -204,6 +214,7 @@ pub mod builder {
try!(entry.get_header_mut().insert("habit.template.recurspec", Value::String(recur))); try!(entry.get_header_mut().insert("habit.template.recurspec", Value::String(recur)));
try!(entry.get_header_mut().insert("habit.template.comment", Value::String(comment))); try!(entry.get_header_mut().insert("habit.template.comment", Value::String(comment)));
debug!("Success: Created entry in store and set headers");
Ok(entry) Ok(entry)
} }