From c4aa0979de2e8f5dfec3e08b9a9363477a5fae63 Mon Sep 17 00:00:00 2001 From: Roman Glushko Date: Tue, 26 Dec 2023 19:04:40 +0200 Subject: [PATCH 1/2] Added more logging to track raw events before processing --- Cargo.toml | 2 +- pyproject.toml | 2 +- src/watcher.rs | 7 ++++++- 3 files changed, 8 insertions(+), 3 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index c97fa63..6242202 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "notifykit_lib" -version = "0.0.3" +version = "0.0.4" edition = "2021" license = "A toolkit for building applications watching filesystem changes" homepage = "https://github.com/roma-glushko/notifykit" diff --git a/pyproject.toml b/pyproject.toml index c37f75d..6cd25eb 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [project] name = "notifykit" -version = "0.0.3" +version = "0.0.4" description = "A modern efficient Python toolkit for building applications that need to watch filesystem changes" authors = [ {name = "Roman Glushko", email = "roman.glushko.m@gmail.com"}, diff --git a/src/watcher.rs b/src/watcher.rs index 05d4c97..2b0b35d 100644 --- a/src/watcher.rs +++ b/src/watcher.rs @@ -43,11 +43,16 @@ impl Watcher { ))); let processor_c = processor.clone(); + let debug_c = debug.clone() let watcher = RecommendedWatcher::new( move |e: Result| { let mut event_processor = processor_c.lock().unwrap(); + if debug_c { + println!("raw event: {:?}", e); + } + match e { Ok(e) => event_processor.add_event(e), Err(e) => event_processor.add_error(e), @@ -161,7 +166,7 @@ impl Watcher { } if !raw_events.is_empty() && self.debug { - println!("raw_events: {:?}", raw_events); + println!("processed events: {:?}", raw_events); } if !errors.is_empty() { From e7ae1da7cf7e727f41a864592e3a194450ab3d52 Mon Sep 17 00:00:00 2001 From: Roman Glushko Date: Tue, 26 Dec 2023 19:14:09 +0200 Subject: [PATCH 2/2] Simplifying the thing --- Cargo.lock | 2 +- src/watcher.rs | 3 +-- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 3f836a3..4e4c61e 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -205,7 +205,7 @@ dependencies = [ [[package]] name = "notifykit_lib" -version = "0.0.2" +version = "0.0.4" dependencies = [ "crossbeam-channel", "crossbeam-utils", diff --git a/src/watcher.rs b/src/watcher.rs index 2b0b35d..b37ae03 100644 --- a/src/watcher.rs +++ b/src/watcher.rs @@ -43,13 +43,12 @@ impl Watcher { ))); let processor_c = processor.clone(); - let debug_c = debug.clone() let watcher = RecommendedWatcher::new( move |e: Result| { let mut event_processor = processor_c.lock().unwrap(); - if debug_c { + if debug { println!("raw event: {:?}", e); }