28 lines
709 B
Rust
28 lines
709 B
Rust
|
use crate::message::*;
|
||
|
pub use crate::output::*;
|
||
|
|
||
|
#[derive(Debug)]
|
||
|
pub struct Stdout {}
|
||
|
|
||
|
impl Output for Stdout {
|
||
|
fn new(
|
||
|
_config: &HashMap<String, 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
|
||
|
);
|
||
|
}
|
||
|
}
|