rs_box

Crates.iors_box
lib.rsrs_box
version0.0.25
sourcesrc
created_at2024-05-05 18:56:25.567722
updated_at2024-05-19 08:07:30.412919
descriptionrust develop box
homepagehttps://github.com/george012/rs_box
repositoryhttps://github.com/george012/rs_box
max_upload_size
id1230457
size45,596
WMYeah (george012)

documentation

https://github.com/george012/rs_box

README

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();
    }
}

Commit count: 31

cargo fmt