20 releases
Uses new Rust 2024
new 0.0.28 | Apr 24, 2025 |
---|---|
0.0.27 | Apr 24, 2025 |
0.0.25 | May 19, 2024 |
#98 in #box
953 downloads per month
38KB
856 lines
rs_box
cargo fix --lib -p rs_box --allow-dirty
线程 用法
#[test]
fn test_logs_with_write_logfile() {
// 假设已经在某处设置了全局配置
setup_log_tools("test_project", true, "./logs", LogLevel::LogLevelDebug, 7, LogFileSaveType::LogFileSaveTypeDays);
let num_threads = 100;
let handles: Vec<_> = (0..num_threads).map(|i| {
std::thread::spawn(move || {
// 每个线程创建自己的日志管理器
let thread_logger = LoggerManager::new(&format!("thread_{}", i));
thread_logger.log_info_f(&format!("This is an info message from thread {}", i));
// 其他日志调用...
})
}).collect();
// 等待所有线程完成
for handle in handles {
handle.join().unwrap();
}
}
Dependencies
~4–11MB
~97K SLoC