diff options
| author | Kevin Hoerr <kjhoerr@submelon.dev> | 2026-04-22 14:52:59 -0400 |
|---|---|---|
| committer | Kevin Hoerr <kjhoerr@submelon.dev> | 2026-04-22 14:52:59 -0400 |
| commit | 0952686526e118339b945ccfb84db1dcc69ee2ab (patch) | |
| tree | 983cc5018ba31f88d89c241c951a38a4cae752c8 /src/app | |
| parent | 25246c26c11f485272689b8c7bd7910f90cc38ed (diff) | |
| download | equity-tracker-0952686526e118339b945ccfb84db1dcc69ee2ab.tar.gz equity-tracker-0952686526e118339b945ccfb84db1dcc69ee2ab.tar.bz2 equity-tracker-0952686526e118339b945ccfb84db1dcc69ee2ab.zip | |
Add logging
Diffstat (limited to 'src/app')
| -rw-r--r-- | src/app/mod.rs | 9 | ||||
| -rw-r--r-- | src/app/store/sqlite.rs | 2 |
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) } } |
