Trait spdlog::sink::Sink

source ·
pub trait Sink: Sync + Send {
    fn log(&self, record: &Record<'_>) -> Result<()>;
    fn flush(&self) -> Result<()>;
    fn level_filter(&self) -> LevelFilter;
    fn set_level_filter(&self, level_filter: LevelFilter);
    fn set_formatter(&self, formatter: Box<dyn Formatter>);
    fn set_error_handler(&self, handler: Option<ErrorHandler>);

    fn should_log(&self, level: Level) -> bool { ... }
}
Expand description

A trait for sinks.

Required Methods

Logs a record.

Implementors should always call Sink::should_log internally to filter records.

Flushes any buffered records.

Gets the log level filter.

Sets the log level filter.

Sets the formatter.

Sets a error handler.

Any errors that occur in Sink will be returned as directly as possible (e.g. returned to Logger), but some errors that are not likely to be returned directly will call this error handler. Most of these errors are uncommon.

If no handler is set, errors will be print to stderr and then ignored.

Provided Methods

Determines if a log message with the specified level would be logged.

Implementors