Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: show local timezone on logs #1460

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
13 changes: 10 additions & 3 deletions screenpipe-server/src/bin/screenpipe-server.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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())
Expand Down Expand Up @@ -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 {
Expand Down
29 changes: 17 additions & 12 deletions screenpipe-server/tests/video_utils_test.rs
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

changed this file to fix this issue on the ubuntu test pipeline https://github.com/mediar-ai/screenpipe/actions/runs/13467215994/job/37635339169
image

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

test failed again, but not related with build at least

Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
use anyhow::Result;
use dirs::{self, home_dir};
use screenpipe_core::Language;

Check warning on line 3 in screenpipe-server/tests/video_utils_test.rs

View workflow job for this annotation

GitHub Actions / test-ubuntu

unused import: `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;
Expand Down Expand Up @@ -131,17 +133,20 @@
};

// 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(())
}
Expand Down
Loading