Skip to content

Commit

Permalink
Add some logging, set dev logging level to debug
Browse files Browse the repository at this point in the history
This is leftover from the unsuccessful/incomplete debugging of #136
  • Loading branch information
LucasPickering committed Apr 18, 2024
1 parent 22951d6 commit 880c06f
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
2 changes: 1 addition & 1 deletion run.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
# latest watchexec we can get rid of this.
# https://github.com/watchexec/cargo-watch/issues/269

RUST_LOG=${RUST_LOG:-slumber=trace} watchexec --restart --no-process-group \
RUST_LOG=${RUST_LOG:-slumber=debug} watchexec --restart --no-process-group \
--watch Cargo.toml --watch Cargo.lock --watch src/ \
-- cargo run \
-- $@
8 changes: 7 additions & 1 deletion src/tui.rs
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ use std::{
time::{Duration, Instant},
};
use tokio::sync::mpsc::{self, UnboundedReceiver};
use tracing::{debug, error};
use tracing::{debug, error, info, trace};

/// Main controller struct for the TUI. The app uses a React-like architecture
/// for the view, with a wrapping controller (this struct). The main loop goes
Expand Down Expand Up @@ -161,6 +161,7 @@ impl Tui {

// ===== Message Phase =====
while let Ok(message) = self.messages_rx.try_recv() {
trace!(?message, "Handling message");
// If an error occurs, store it so we can show the user
if let Err(error) = self.handle_message(message) {
self.view.open_modal(error, ModalPriority::High);
Expand All @@ -181,6 +182,7 @@ impl Tui {

/// GOODBYE
fn quit(&mut self) {
info!("Initiating graceful shutdown");
self.should_run = false;
}

Expand Down Expand Up @@ -305,6 +307,10 @@ impl Tui {
})?;
watcher
.watch(self.collection_file.path(), RecursiveMode::NonRecursive)?;
info!(
path = ?self.collection_file.path(), ?watcher,
"Watching collection file for changes"
);
Ok(watcher)
}

Expand Down

0 comments on commit 880c06f

Please sign in to comment.