use std::time::SystemTime;
use super::*;
pub struct StdioEmitter;
impl Emitter for StdioEmitter {
fn emit(&self, file: &str, line: u32, level: u64, value: Value) {
let timestamp = SystemTime::now()
.duration_since(SystemTime::UNIX_EPOCH)
.map(|x| x.as_micros() as f64 / 1_000_000.0)
.unwrap_or(0.0);
let level = match level {
0 => "A",
1..=3 => "E",
4..=6 => "W",
7..=9 => "I",
10..=12 => "D",
13..=15 => "T",
_ => {
return;
}
};
eprintln!("{level} {timestamp:10.6} {file}:{line} {value}");
}
fn flush(&self) {}
}