Trait opentelemetry::logs::Logger

source ·
pub trait Logger {
    type LogRecord: LogRecord;

    // Required methods
    fn create_log_record(&self) -> Self::LogRecord;
    fn emit(&self, record: Self::LogRecord);
    fn event_enabled(&self, level: Severity, target: &str) -> bool;
}
Available on crate feature logs only.
Expand description

The interface for emitting LogRecords.

Required Associated Types§

source

type LogRecord: LogRecord

Specifies the LogRecord type associated with this logger.

Required Methods§

source

fn create_log_record(&self) -> Self::LogRecord

Creates a new log record builder.

source

fn emit(&self, record: Self::LogRecord)

Emit a LogRecord. If there is active current thread’s Context, the logger will set the record’s TraceContext to the active trace context,

source

fn event_enabled(&self, level: Severity, target: &str) -> bool

Available on crate feature logs_level_enabled only.

Check if the given log level is enabled.

Implementors§