26 lines
676 B
Rust
26 lines
676 B
Rust
use crate::message::*;
|
|
pub use crate::output::*;
|
|
|
|
#[derive(Debug)]
|
|
pub struct Stdout {}
|
|
|
|
impl Output for Stdout {
|
|
fn new(_config: serde_yaml::Value) -> Result<Self, Box<dyn std::error::Error>> {
|
|
Ok(Stdout {})
|
|
}
|
|
fn process_message(&mut self, message: Message) {
|
|
log::info!(
|
|
"{}{}: {}\x1B[m",
|
|
match message.level {
|
|
Level::Debug => "\x1B[2m",
|
|
Level::Notice => "",
|
|
Level::Anomaly => "\x1B[33m",
|
|
Level::Issue => "\x1B[31m",
|
|
Level::Critical => "\x1B[31;40;1m",
|
|
},
|
|
message.msg_type,
|
|
message.text
|
|
);
|
|
}
|
|
}
|