Working on logging

This commit is contained in:
veeso
2021-05-16 15:09:17 +02:00
parent 4e287a0231
commit 7f9d92cbe9
8 changed files with 294 additions and 25 deletions

View File

@@ -50,6 +50,7 @@ impl ConfigSerializer {
))
}
};
trace!("Serialized new configuration data: {}", data);
// Write file
match writable.write_all(data.as_bytes()) {
Ok(_) => Ok(()),
@@ -72,9 +73,13 @@ impl ConfigSerializer {
err.to_string(),
));
}
trace!("Read configuration from file: {}", data);
// Deserialize
match toml::de::from_str(data.as_str()) {
Ok(hosts) => Ok(hosts),
Ok(config) => {
debug!("Read config from file {:?}", config);
Ok(config)
}
Err(err) => Err(SerializerError::new_ex(
SerializerErrorKind::SyntaxError,
err.to_string(),