Trait LogRecord
pub trait LogRecord {
// Required methods
fn set_event_name(&mut self, name: &'static str);
fn set_target<T>(&mut self, _target: T)
where T: Into<Cow<'static, str>>;
fn set_timestamp(&mut self, timestamp: SystemTime);
fn set_observed_timestamp(&mut self, timestamp: SystemTime);
fn set_severity_text(&mut self, text: &'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_trace_context(
&mut self,
trace_id: TraceId,
span_id: SpanId,
trace_flags: Option<TraceFlags>,
) { ... }
}
Expand description
SDK implemented trait for managing log records
Required Methods§
fn set_event_name(&mut self, name: &'static str)
fn set_event_name(&mut self, name: &'static str)
Sets the event_name
of a record
fn set_target<T>(&mut self, _target: T)
fn set_target<T>(&mut self, _target: T)
Sets the target
of a record.
Currently, both opentelemetry-appender-tracing
and opentelemetry-appender-log
create a single logger
with a scope that doesn’t accurately reflect the component emitting the logs.
Exporters MAY use this field to override the instrumentation_scope.name
.
fn set_timestamp(&mut self, timestamp: SystemTime)
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.
fn set_observed_timestamp(&mut self, timestamp: SystemTime)
fn set_observed_timestamp(&mut self, timestamp: SystemTime)
Sets the observed event timestamp.
fn set_severity_text(&mut self, text: &'static str)
fn set_severity_text(&mut self, text: &'static str)
Sets severity as text.
fn set_severity_number(&mut self, number: Severity)
fn set_severity_number(&mut self, number: Severity)
Sets severity as a numeric value.
fn add_attributes<I, K, V>(&mut self, attributes: I)
fn add_attributes<I, K, V>(&mut self, attributes: I)
Adds multiple attributes.
fn add_attribute<K, V>(&mut self, key: K, value: V)
fn add_attribute<K, V>(&mut self, key: K, value: V)
Adds a single attribute.
Provided Methods§
fn set_trace_context(
&mut self,
trace_id: TraceId,
span_id: SpanId,
trace_flags: Option<TraceFlags>,
)
fn set_trace_context( &mut self, trace_id: TraceId, span_id: SpanId, trace_flags: Option<TraceFlags>, )
Sets the trace context of the log.
Object Safety§
This trait is not object safe.