diff --git a/sgl-model-gateway/src/observability/logging.rs b/sgl-model-gateway/src/observability/logging.rs index 188d9b1b1..a85fbdd7f 100644 --- a/sgl-model-gateway/src/observability/logging.rs +++ b/sgl-model-gateway/src/observability/logging.rs @@ -16,8 +16,16 @@ use super::otel_trace::get_otel_layer; use crate::config::TraceConfig; const TIME_FORMAT: &str = "%Y-%m-%d %H:%M:%S"; +const TIME_FORMAT_MS: &str = "%Y-%m-%d %H:%M:%S%.3f"; const DEFAULT_LOG_TARGET: &str = "smg"; +fn get_time_format() -> &'static str { + match std::env::var("SGLANG_LOG_MS") { + Ok(v) if matches!(v.trim().to_lowercase().as_str(), "true" | "1") => TIME_FORMAT_MS, + _ => TIME_FORMAT, + } +} + #[derive(Debug, Clone)] pub struct LoggingConfig { pub level: Level, @@ -102,11 +110,13 @@ pub fn init_logging(config: LoggingConfig, otel_layer_config: Option