Skip to content

YC (S26) | Open Computer History | Continuously record your company computer work, map your workflows, help you find work worth automating, and power your agents' context

feat: show local timezone on logs (#1460)

ologbonowiwiad12ab96a631
diff --git a/Cargo.toml b/Cargo.toml
index c47494380..258914cd7 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -30,7 +30,7 @@ hf-hub = { version = "0.3.2", git = "https://github.com/neo773/hf-hub", features
] }
log = "0.4"
tracing = "0.1.40"
-tracing-subscriber = { version = "0.3.18", features = ["env-filter"] }
+tracing-subscriber = { version = "0.3.19", features = ["env-filter", "chrono"] }
tracing-appender = { version = "0.2.3" }
tokio = { version = "1.15", features = ["full", "tracing"] }
crossbeam = "0.8.4"
diff --git a/screenpipe-server/src/bin/screenpipe-server.rs b/screenpipe-server/src/bin/screenpipe-server.rs
index 2cc5c342b..d5272b39b 100644
--- a/screenpipe-server/src/bin/screenpipe-server.rs
+++ b/screenpipe-server/src/bin/screenpipe-server.rs
@@ -74,7 +74,7 @@ fn setup_logging(local_data_dir: &PathBuf, cli: &Cli) -> anyhow::Result<WorkerGu
.max_log_files(5)
.build(local_data_dir)?;
- let (non_blocking, guard) = tracing_appender::non_blocking(file_appender);
+ let (file_writer, guard) = tracing_appender::non_blocking(file_appender);
let env_filter = EnvFilter::from_default_env()
.add_directive("info".parse().unwrap())
@@ -114,10 +114,17 @@ fn setup_logging(local_data_dir: &PathBuf, cli: &Cli) -> anyhow::Result<WorkerGu
env_filter
};
+ let timer =
+ tracing_subscriber::fmt::time::ChronoLocal::new("%Y-%m-%dT%H:%M:%S%.6fZ".to_string());
+
let registry = tracing_subscriber::registry()
.with(env_filter)
- .with(fmt::layer().with_writer(std::io::stdout))
- .with(fmt::layer().with_writer(non_blocking));
+ .with(
+ fmt::layer()
+ .with_writer(std::io::stdout)
+ .with_timer(timer.clone()),
+ )
+ .with(fmt::layer().with_writer(file_writer).with_timer(timer));
// Build the final registry with conditional Sentry layer
if !cli.disable_telemetry {
diff --git a/screenpipe-server/tests/video_utils_test.rs b/screenpipe-server/tests/video_utils_test.rs
index c1a43e3ee..7e055b2d7 100644
--- a/screenpipe-server/tests/video_utils_test.rs
+++ b/screenpipe-server/tests/video_utils_test.rs
@@ -2,7 +2,9 @@ use anyhow::Result;
use dirs::{self, home_dir};
use screenpipe_core::Language;
use screenpipe_server::video_utils::extract_frames_from_video;
-use screenpipe_vision::{capture_screenshot_by_window::CapturedWindow, perform_ocr_apple};
+use screenpipe_vision::capture_screenshot_by_window::CapturedWindow;
+#[cfg(target_os = "macos")]
+use screenpipe_vision::perform_ocr_apple;
use std::path::PathBuf;
use tokio::fs;
use tracing::info;
@@ -131,17 +133,20 @@ async fn test_extract_frames_and_ocr() -> Result<()> {
};
// perform ocr using apple native (macos only)
- let (text, _, confidence) = perform_ocr_apple(&captured_window.image, &[Language::English]);
-
- println!("ocr confidence: {}", confidence.unwrap_or(0.0));
- println!("extracted text: {}", text);
-
- // basic validation
- assert!(!text.is_empty(), "ocr should extract some text");
- assert!(
- confidence.unwrap_or(0.0) > 0.0,
- "confidence should be greater than 0"
- );
+ #[cfg(target_os = "macos")]
+ {
+ let (text, _, confidence) = perform_ocr_apple(&captured_window.image, &[Language::English]);
+
+ println!("ocr confidence: {}", confidence.unwrap_or(0.0));
+ println!("extracted text: {}", text);
+
+ // basic validation
+ assert!(!text.is_empty(), "ocr should extract some text");
+ assert!(
+ confidence.unwrap_or(0.0) > 0.0,
+ "confidence should be greater than 0"
+ );
+ }
Ok(())
}