From 7032318858c71cd2dd92f5e74607b8a1dea3b7b9 Mon Sep 17 00:00:00 2001 From: weisd Date: Fri, 6 Jun 2025 16:46:12 +0800 Subject: [PATCH] update obs --- crates/obs/Cargo.toml | 2 +- crates/obs/src/telemetry.rs | 11 ++++++++++- 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/crates/obs/Cargo.toml b/crates/obs/Cargo.toml index e22651030..e7677df89 100644 --- a/crates/obs/Cargo.toml +++ b/crates/obs/Cargo.toml @@ -38,7 +38,7 @@ tracing-error = { workspace = true } tracing-opentelemetry = { workspace = true } tracing-subscriber = { workspace = true, features = ["registry", "std", "fmt", "env-filter", "tracing-log", "time", "local-time", "json"] } tokio = { workspace = true, features = ["sync", "fs", "rt-multi-thread", "rt", "time", "macros"] } -reqwest = { workspace = true, optional = true, default-features = false } +reqwest = { workspace = true, optional = true } serde_json = { workspace = true } sysinfo = { workspace = true } thiserror = { workspace = true } diff --git a/crates/obs/src/telemetry.rs b/crates/obs/src/telemetry.rs index 5cb86f092..96b200a6c 100644 --- a/crates/obs/src/telemetry.rs +++ b/crates/obs/src/telemetry.rs @@ -329,7 +329,16 @@ pub(crate) fn init_telemetry(config: &OtelConfig) -> OtelGuard { }; // Configure the flexi_logger - let flexi_logger_result = flexi_logger::Logger::with(log_spec) + let flexi_logger_result = flexi_logger::Logger::try_with_env_or_str(logger_level) + .unwrap_or_else(|e| { + eprintln!( + "Invalid logger level: {}, using default: {},failed error:{}", + logger_level, + DEFAULT_LOG_LEVEL, + e.to_string() + ); + flexi_logger::Logger::with(log_spec.clone()) + }) .log_to_file( FileSpec::default() .directory(log_directory)