1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
pub fn init_file_per_thread_logger(prefix: &'static str) {
file_per_thread_logger::initialize(prefix);
rayon::ThreadPoolBuilder::new()
.spawn_handler(move |thread| {
let mut b = std::thread::Builder::new();
if let Some(name) = thread.name() {
b = b.name(name.to_owned());
}
if let Some(stack_size) = thread.stack_size() {
b = b.stack_size(stack_size);
}
b.spawn(move || {
file_per_thread_logger::initialize(prefix);
thread.run()
})?;
Ok(())
})
.build_global()
.unwrap();
}