feat: OXIDE_LOG_FILE 环境变量启用按日滚动日志文件输出

This commit is contained in:
2026-09-26 11:42:45 +00:00
parent 0c2f4c2d67
commit 30cc50aa70
2 changed files with 13 additions and 2 deletions
+6 -1
View File
@@ -95,8 +95,13 @@ fn run_tests() -> bool {
}
}
eprintln!("[LOG] level={log_level:?}");
// OXIDE_LOG_FILE 指向目录时日志按日滚动落盘该目录(同镜像 stderr),缺省仅 stderr。
let output = match std::env::var("OXIDE_LOG_FILE") {
Ok(dir) if !dir.is_empty() => Output::File(PathBuf::from(dir)),
_ => Output::Stderr,
};
oxide_log::init(&LogConfig {
output: Output::Stderr,
output,
levels: [log_level; SUBSYSTEM_COUNT],
});