LogListener

Trait LogListener 

Source
pub trait LogListener: 'static + Sync {
    // Required methods
    fn log(&self, ctx: &LogContext<'_>, lvl: BnLogLevel, msg: &str);
    fn level(&self) -> BnLogLevel;

    // Provided method
    fn close(&self) { ... }
}
Expand description

The trait implemented by objects that wish to receive log messages from the core.

Currently, we supply one implementation of this trait called crate::tracing::TracingLogListener which will send the core logs to the registered tracing subscriber.

Required Methods§

Source

fn log(&self, ctx: &LogContext<'_>, lvl: BnLogLevel, msg: &str)

Called when a log message is received from the core.

Logs will only be sent that are above the desired LogListener::level.

Source

fn level(&self) -> BnLogLevel

The desired minimum log level, any logs below this level will be ignored.

For example, returning BnLogLevel::InfoLog will result in BnLogLevel::DebugLog logs being ignored by this listener.

Provided Methods§

Source

fn close(&self)

Called when the listener is unregistered.

Implementors§