Trait opentelemetry::logs::LogRecord

source ·
pub trait LogRecord {
    // Required methods
    fn set_timestamp(&mut self, timestamp: SystemTime);
    fn set_observed_timestamp(&mut self, timestamp: SystemTime);
    fn set_severity_text(&mut self, text: Cow<'static, str>);
    fn set_severity_number(&mut self, number: Severity);
    fn set_body(&mut self, body: AnyValue);
    fn add_attributes<I, K, V>(&mut self, attributes: I)
       where I: IntoIterator<Item = (K, V)>,
             K: Into<Key>,
             V: Into<AnyValue>;
    fn add_attribute<K, V>(&mut self, key: K, value: V)
       where K: Into<Key>,
             V: Into<AnyValue>;

    // Provided method
    fn set_event_name<T>(&mut self, _name: T)
       where T: Into<Cow<'static, str>> { ... }
}
Available on crate feature logs only.
Expand description

SDK implemented trait for managing log records

Required Methods§

source

fn set_timestamp(&mut self, timestamp: SystemTime)

Sets the time when the event occurred measured by the origin clock, i.e. the time at the source.

source

fn set_observed_timestamp(&mut self, timestamp: SystemTime)

Sets the observed event timestamp.

source

fn set_severity_text(&mut self, text: Cow<'static, str>)

Sets severity as text.

source

fn set_severity_number(&mut self, number: Severity)

Sets severity as a numeric value.

source

fn set_body(&mut self, body: AnyValue)

Sets the message body of the log.

source

fn add_attributes<I, K, V>(&mut self, attributes: I)
where I: IntoIterator<Item = (K, V)>, K: Into<Key>, V: Into<AnyValue>,

Adds multiple attributes.

source

fn add_attribute<K, V>(&mut self, key: K, value: V)
where K: Into<Key>, V: Into<AnyValue>,

Adds a single attribute.

Provided Methods§

source

fn set_event_name<T>(&mut self, _name: T)
where T: Into<Cow<'static, str>>,

Sets the event_name of a record

Object Safety§

This trait is not object safe.

Implementors§