pub mod black_hole;
pub mod file;
pub mod io;
pub mod log_file;
pub mod stderr;
pub mod stdout;
pub mod string;
use ntime;
use std::io as std_io;
use crate::attributes;
use crate::level;
pub type LogDepth = u16;
pub const MAX_LOGDEPTH: u16 = 1024;
#[derive(Clone, Debug)]
pub struct LogUpdate {
pub when: ntime::Timestamp,
pub level: level::Level,
pub msg: String,
}
impl LogUpdate {
pub fn new(now: ntime::Timestamp, level: level::Level, msg: String) -> Self {
Self {
when: now,
level: level,
msg: msg,
}
}
}
pub trait Sink {
fn name(&self) -> &str;
fn log(&mut self, update: &LogUpdate, attrs: &attributes::Map) -> std_io::Result<()>;
fn flush(&mut self) -> std_io::Result<()>;
fn receives_all_levels(&self) -> bool {
false
}
}