fix: sentry init 日志从 info! 改为 eprintln!(tracing 初始化前不输出)

This commit is contained in:
2026-05-14 10:59:48 +08:00
parent f8a95c7417
commit 5dce0e3332

View File

@@ -143,7 +143,7 @@ async fn main() -> std::io::Result<()> {
// Sentry 初始化(仅在 SENTRY_DSN 环境变量已设置时启用)
let _sentry_guard = if let Ok(dsn) = std::env::var("SENTRY_DSN") {
if !dsn.is_empty() {
info!("Sentry 已初始化");
eprintln!("[SENTRY] Sentry 已初始化 (DSN: {})", dsn);
Some(sentry::init((
dsn,
sentry::ClientOptions {
@@ -156,11 +156,11 @@ async fn main() -> std::io::Result<()> {
},
)))
} else {
info!("SENTRY_DSN 为空,跳过 Sentry 初始化");
eprintln!("[SENTRY] SENTRY_DSN 为空,跳过 Sentry 初始化");
None
}
} else {
info!("未设置 SENTRY_DSN跳过 Sentry 初始化");
eprintln!("[SENTRY] 未设置 SENTRY_DSN跳过 Sentry 初始化");
None
};