You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Jun 16, 2026. It is now read-only.
问题
lib/src/rbt_infra/rbt_log.rs:73中logger_init()调用log::set_boxed_logger()来安装全局 logger。这是 Rust log 生态的全局单例——只能成功调用一次,第二次会返回Err。当前函数名和签名(
pub fn logger_init() -> RbtResult<Option<RbtLoggerGuard>>)看起来像可重复调用。如果被意外调用两次,第二次会 panic(map_err将错误直接转换成RbtError::LoggerInitError,但下游代码可能没有正确处理)。修法
std::sync::OnceLock做幂等保护,第二次调用直接返回Ok(None),并记录一条 warn位置
lib/src/rbt_infra/rbt_log.rs:73—log::set_boxed_logger()调用处