std_out_separate_thread_no_thread_names/
no-thread-names.rs1use std::thread;
2
3use rslogger::Logger;
4use log::{info, warn, error};
5
6fn main() {
7 Logger::new()
8 .with_level(log::LevelFilter::Trace)
9 .with_local_timestamps()
10 .add_writer_stdout(false, None)
11 .init().unwrap();
12
13 let handler1 = thread::Builder::new().name("Thread 1".to_string()).spawn(move | | {
14 for i in 0..10 {
15 info!("This is a info, i: {i}");
16 }
17 }).unwrap();
18
19 let handler2 = thread::Builder::new().name("Thread 2".to_string()).spawn(move | | {
20 for i in 0..10 {
21 info!("This is a info, i: {i}");
22 }
23 }).unwrap();
24
25 warn!("Warning on main!");
26
27 handler1.join().unwrap();
28 handler2.join().unwrap();
29
30 log::logger().flush();
31}