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/main.rs | |
| parent | 25246c26c11f485272689b8c7bd7910f90cc38ed (diff) | |
| download | equity-tracker-0952686526e118339b945ccfb84db1dcc69ee2ab.tar.gz equity-tracker-0952686526e118339b945ccfb84db1dcc69ee2ab.tar.bz2 equity-tracker-0952686526e118339b945ccfb84db1dcc69ee2ab.zip | |
Add logging
Diffstat (limited to 'src/main.rs')
| -rw-r--r-- | src/main.rs | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/src/main.rs b/src/main.rs index bb63c86..d1d4ee4 100644 --- a/src/main.rs +++ b/src/main.rs @@ -1,4 +1,5 @@ mod app; +mod logging; mod ui; use app::App; @@ -24,9 +25,15 @@ fn main() -> Result<()> { let backend = CrosstermBackend::new(stdout); let mut term = Terminal::new(backend).into_diagnostic()?; + logging::initialize_logging().into_diagnostic()?; + + tracing::event!(tracing::Level::DEBUG, "App initialization started."); + let mut app = App::default(); app.init_context()?; + tracing::event!(tracing::Level::INFO, "App started."); + // could be error, so don't unwrap; let term restore first let run = run_app(&mut term, &mut app); @@ -67,6 +74,11 @@ fn run_app<B: Backend>(term: &mut Terminal<B>, app: &mut App) -> Result<()> { /// Process user input and run associated app functions fn handle_key_event(app: &mut App, key_event: KeyEvent) -> Result<()> { + tracing::event!( + tracing::Level::TRACE, + event = key_event.code.to_string(), + "Received key event." + ); match key_event.code { KeyCode::Char('q') => app.exit()?, KeyCode::Left => app.decrement_counter()?, |
