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 32 33
//! Filters use std::fmt; use log::LogRecord; pub mod threshold; /// The trait implemented by log4rs filters. /// /// Filters are associated with appenders and limit the log events that will be /// sent to that appender. pub trait Filter: fmt::Debug + Send + Sync + 'static { /// Filters a log event. fn filter(&self, record: &LogRecord) -> Response; } /// The response returned by a filter. pub enum Response { /// Accept the log event. /// /// It will be immediately passed to the appender, bypassing any remaining /// filters. Accept, /// Take no action on the log event. /// /// It will continue on to remaining filters or pass on to the appender if /// there are none remaining. Neutral, /// Reject the log event. Reject, }