use log and env_logger, and add some logging around sync

This commit is contained in:
Dustin J. Mitchell
2020-11-29 18:18:28 -05:00
parent c117494ce6
commit 0a1ee470f7
13 changed files with 109 additions and 14 deletions

View File

@@ -2,6 +2,7 @@ use crate::replica::Replica;
use crate::taskstorage::TaskMap;
use chrono::prelude::*;
use failure::Fallible;
use log::trace;
use uuid::Uuid;
pub type Timestamp = DateTime<Utc>;
@@ -230,6 +231,7 @@ impl<'r> TaskMut<'r> {
let now = format!("{}", Utc::now().timestamp());
self.replica
.update_task(self.task.uuid, "modified", Some(now.clone()))?;
trace!("task {}: set property modified={:?}", self.task.uuid, now);
self.task.taskmap.insert(String::from("modified"), now);
self.updated_modified = true;
}
@@ -242,8 +244,10 @@ impl<'r> TaskMut<'r> {
.update_task(self.task.uuid, property, value.as_ref())?;
if let Some(v) = value {
trace!("task {}: set property {}={:?}", self.task.uuid, property, v);
self.task.taskmap.insert(property.to_string(), v);
} else {
trace!("task {}: remove property {}", self.task.uuid, property);
self.task.taskmap.remove(property);
}
Ok(())