aboutsummaryrefslogtreecommitdiff
path: root/src/app
diff options
context:
space:
mode:
Diffstat (limited to 'src/app')
-rw-r--r--src/app/mod.rs9
-rw-r--r--src/app/store/sqlite.rs2
2 files changed, 11 insertions, 0 deletions
diff --git a/src/app/mod.rs b/src/app/mod.rs
index 15290ef..d51640f 100644
--- a/src/app/mod.rs
+++ b/src/app/mod.rs
@@ -34,6 +34,7 @@ impl App {
}
pub fn exit(&mut self) -> Result<()> {
+ tracing::event!(tracing::Level::TRACE, exit = true, "Changing exit status.");
self.exit = true;
Ok(())
}
@@ -42,6 +43,7 @@ impl App {
let store = self.context.unwrap_store();
let count = store.get_counter()?;
+ tracing::event!(tracing::Level::TRACE, count, "Decrementing counter.");
if count == 0 {
Err(OverflowError {
_msg: "Cannot count below 0".into(),
@@ -57,6 +59,7 @@ impl App {
let store = self.context.unwrap_store();
let count = store.get_counter()?;
+ tracing::event!(tracing::Level::TRACE, count, "Incrementing counter.");
if count == u8::MAX {
Err(OverflowError {
_msg: "Cannot count above u8::MAX".into(),
@@ -77,6 +80,12 @@ impl App {
}
pub fn set_error(&mut self, error: ErrReport) -> Result<()> {
+ tracing::event!(
+ tracing::Level::ERROR,
+ error = error.to_string(),
+ help = error.help().map_or(String::default(), |h| h.to_string())
+ );
+
self.error = Some(error);
Ok(())
}
diff --git a/src/app/store/sqlite.rs b/src/app/store/sqlite.rs
index 4f5f8f2..e971ef3 100644
--- a/src/app/store/sqlite.rs
+++ b/src/app/store/sqlite.rs
@@ -87,6 +87,8 @@ impl Store for SQLiteStore {
fn set_counter(&mut self, new_count: u8) -> Result<u8, ContextError> {
self.update_counter(i64::from(new_count))?;
+ tracing::event!(tracing::Level::DEBUG, new_count, "Updated counter.");
+
Ok(new_count)
}
}