From 0952686526e118339b945ccfb84db1dcc69ee2ab Mon Sep 17 00:00:00 2001 From: Kevin Hoerr Date: Wed, 22 Apr 2026 14:52:59 -0400 Subject: Add logging --- src/main.rs | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'src/main.rs') 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(term: &mut Terminal, 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()?, -- cgit v1.3