pub struct SinkProp { /* private fields */ }
Expand description
Contains definitions of sink properties.
It provides a set of common properties for sink to define. If there is no
special need for properties, use it directly and then implement
GetSinkProp
for your sink, a blanket implementation will be enabled,
which would eliminate a lot of boilerplate code.
If further customization of the properties is needed (e.g., using different
types, changing behavior), this struct is not needed. Instead, define
properties manually within your sink, and then implement SinkPropAccess
.
Implementations§
Source§impl SinkProp
impl SinkProp
Sourcepub fn level_filter(&self) -> LevelFilter
pub fn level_filter(&self) -> LevelFilter
Gets the log level filter.
Sourcepub fn set_level_filter(&self, level_filter: LevelFilter)
pub fn set_level_filter(&self, level_filter: LevelFilter)
Sets the log level filter.
Sourcepub fn formatter<'a>(&'a self) -> impl Deref<Target = dyn Formatter> + 'a
pub fn formatter<'a>(&'a self) -> impl Deref<Target = dyn Formatter> + 'a
Gets the formatter.
The returned value is a lock guard, so please avoid storing it in a variable with a longer lifetime.
Sourcepub fn set_formatter<F>(&self, formatter: F)where
F: Formatter + 'static,
pub fn set_formatter<F>(&self, formatter: F)where
F: Formatter + 'static,
Sets the formatter.
Sourcepub fn set_formatter_boxed(&self, formatter: Box<dyn Formatter>)
pub fn set_formatter_boxed(&self, formatter: Box<dyn Formatter>)
Sets the boxed formatter.
Sourcepub fn call_error_handler(&self, err: Error)
pub fn call_error_handler(&self, err: Error)
Calls the error handler with an error.
Sourcepub fn set_error_handler<F: Into<ErrorHandler>>(&self, handler: F)
pub fn set_error_handler<F: Into<ErrorHandler>>(&self, handler: F)
Sets a error handler.
Most errors that occur in Sink
will be returned as directly as
possible (e.g. returned to Logger
), but some errors that cannot be
returned immediately, this function will be called. For example,
asynchronous errors.