pub struct DMSCLogContext;Expand description
Log context for DMSC, similar to MDC with distributed tracing support.
This struct provides a thread-local logging context that can be used to add contextual information to logs. It includes built-in support for distributed tracing with trace IDs, span IDs, and parent span IDs.
Implementations§
Source§impl DMSCLogContext
impl DMSCLogContext
Sourcepub fn put(key: impl Into<String>, value: impl Into<String>)
pub fn put(key: impl Into<String>, value: impl Into<String>)
Puts a key-value pair into the log context.
§Parameters
key: The context keyvalue: The context value
Sourcepub fn put_all(values: HashMap<String, String>)
pub fn put_all(values: HashMap<String, String>)
Puts multiple key-value pairs into the log context.
§Parameters
values: A HashMap of key-value pairs to add to the context
Sourcepub fn get_all() -> HashMap<String, String>
pub fn get_all() -> HashMap<String, String>
Gets all key-value pairs from the log context.
§Returns
A HashMap containing all key-value pairs in the context
Sourcepub fn set_trace_id(trace_id: impl Into<String>)
pub fn set_trace_id(trace_id: impl Into<String>)
Sourcepub fn get_trace_id() -> Option<String>
pub fn get_trace_id() -> Option<String>
Gets the trace ID from the log context.
§Returns
An Option<String> containing the trace ID if it exists
Sourcepub fn generate_trace_id() -> String
pub fn generate_trace_id() -> String
Sourcepub fn set_span_id(span_id: impl Into<String>)
pub fn set_span_id(span_id: impl Into<String>)
Sourcepub fn get_span_id() -> Option<String>
pub fn get_span_id() -> Option<String>
Gets the span ID from the log context.
§Returns
An Option<String> containing the span ID if it exists
Sourcepub fn generate_span_id() -> String
pub fn generate_span_id() -> String
Sourcepub fn set_parent_span_id(parent_span_id: impl Into<String>)
pub fn set_parent_span_id(parent_span_id: impl Into<String>)
Sourcepub fn get_parent_span_id() -> Option<String>
pub fn get_parent_span_id() -> Option<String>
Gets the parent span ID from the log context.
§Returns
An Option<String> containing the parent span ID if it exists
Auto Trait Implementations§
impl Freeze for DMSCLogContext
impl RefUnwindSafe for DMSCLogContext
impl Send for DMSCLogContext
impl Sync for DMSCLogContext
impl Unpin for DMSCLogContext
impl UnwindSafe for DMSCLogContext
Blanket Implementations§
§impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
§impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§impl<T> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
Source§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
T in a tonic::RequestSource§impl<T> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
Source§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
T in a tonic::Request