file manager
git clone https://git.lucas.co/cce-files.git
refactor: modernize and systematize workspace logging
Cargo.toml | 2 ++
src/main.rs | 6 +++---
src/pages/browse.rs | 2 +-
3 files changed, 6 insertions(+), 4 deletions(-)
diff --git a/Cargo.toml b/Cargo.toml
index 972e947..e8d46ff 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -14,6 +14,8 @@ chrono = "0.4.44"
tokio = { version = "1", features = ["full"] }
notify = "8.2.0"
image = { version = "0.25.10", features = ["png", "jpeg"] }
+log = "0.4"
+
[lib]
name = "cce_filesystem_interface"
diff --git a/src/main.rs b/src/main.rs
index 1fc24f9..9506d7f 100644
--- a/src/main.rs
+++ b/src/main.rs
@@ -109,13 +109,13 @@ impl FilesystemApp {
) {
Ok(w) => w,
Err(e) => {
- eprintln!("Failed to create watcher: {:?}", e);
+ log::error!("Failed to create watcher: {:?}", e);
return;
}
};
if let Err(e) = watcher.watch(&path, RecursiveMode::NonRecursive) {
- eprintln!("Failed to watch path {}: {:?}", path.display(), e);
+ log::error!("Failed to watch path {}: {:?}", path.display(), e);
return;
}
@@ -1063,7 +1063,7 @@ impl Application for FilesystemApp {
let mut changed = false;
- eprintln!("[DEBUG] MOUSE INPUT: {:?} {:?} pos=({}, {})", button, state, pos.x, pos.y);
+ log::debug!("MOUSE INPUT: {:?} {:?} pos=({}, {})", button, state, pos.x, pos.y);
let menu_match = !self.select_mode && self.paginator.mouse_input(button, state, pos.x, pos.y, &mut self.ui_context);
if menu_match {
if let Some((idx, _)) = self.paginator.menu_click() {
diff --git a/src/pages/browse.rs b/src/pages/browse.rs
index 31c9341..2876350 100644
--- a/src/pages/browse.rs
+++ b/src/pages/browse.rs
@@ -405,7 +405,7 @@ pub fn update(state: &mut BrowseState, msg: BrowseMessage) -> Option<crate::serv
}
}
Err(e) => {
- eprintln!("Failed to delete {}: {}", path.display(), e);
+ log::error!("Failed to delete {}: {}", path.display(), e);
}
}
Some(crate::services::fs::FsRequest::ReadDirectory(state.current_dir.clone()))