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
26
27
28
29
30
31
crate::ix!();

pub trait Flushable {
    fn flush(&self);
}

impl Flushable for BufferedLayer {

    fn flush(&self) {

        use colored::Colorize;

        if let Ok(mut buf) = self.buffer.lock() {

            if let Some(tag) = &self.tag {

                let msg = format!("---------------------------------------------------------[trace_events: {}]", tag);

                println!(
                    "{}",
                    msg.bright_blue(),
                );
            }

            for message in &*buf {
                println!("{}", message);
            }
            buf.clear();
        }
    }
}