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>,
) { ... }
}
Available on crate feature
logs
only.Expand description
SDK implemented trait for managing log records
Required Methods§
Sourcefn set_event_name(&mut self, name: &'static str)
fn set_event_name(&mut self, name: &'static str)
Sets the event_name
of a record
Sourcefn 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
.
Sourcefn 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.
Sourcefn set_observed_timestamp(&mut self, timestamp: SystemTime)
fn set_observed_timestamp(&mut self, timestamp: SystemTime)
Sets the observed event timestamp.
Sourcefn set_severity_text(&mut self, text: &'static str)
fn set_severity_text(&mut self, text: &'static str)
Sets severity as text.
Sourcefn set_severity_number(&mut self, number: Severity)
fn set_severity_number(&mut self, number: Severity)
Sets severity as a numeric value.
Sourcefn add_attributes<I, K, V>(&mut self, attributes: I)
fn add_attributes<I, K, V>(&mut self, attributes: I)
Adds multiple attributes.
Provided Methods§
Sourcefn set_trace_context(
&mut self,
trace_id: TraceId,
span_id: SpanId,
trace_flags: Option<TraceFlags>,
)
Available on crate feature trace
only.
fn set_trace_context( &mut self, trace_id: TraceId, span_id: SpanId, trace_flags: Option<TraceFlags>, )
trace
only.Sets the trace context of the log.
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.