pub struct LogContext {
pub local: LogRecords,
pub inherited: LogRecords,
}Expand description
A set of records that can be attached to a logging scope.
Records are split into two categories:
- local - records belonging only to the current scope. They do not propagate to child scopes.
- inherited - records that automatically flow into all child scopes created within the current scope.
Nested scopes resolution rules:
- child
inheritedoverwrites parentinheritedby key - inherited are emitted before local, so “last write wins” consumers see local shadowing
Fields§
§local: LogRecordsRecords belonging only to the current scope.
inherited: LogRecordsRecords that automatically flow into all child scopes created within the current scope.
Implementations§
Source§impl LogContext
impl LogContext
Sourcepub fn with_local_record(
self,
key: impl Into<Cow<'static, str>>,
value: impl Into<LogValue>,
) -> Self
pub fn with_local_record( self, key: impl Into<Cow<'static, str>>, value: impl Into<LogValue>, ) -> Self
Adds a key-value record to the local records of this context.
See LogRecords for more details about log records.
Sourcepub fn with_inherited_record(
self,
key: impl Into<Cow<'static, str>>,
value: impl Into<LogValue>,
) -> Self
pub fn with_inherited_record( self, key: impl Into<Cow<'static, str>>, value: impl Into<LogValue>, ) -> Self
Adds a key-value record to the inherited records of this context.
See LogRecords for more details about log records.
Trait Implementations§
Source§impl Clone for LogContext
impl Clone for LogContext
Source§fn clone(&self) -> LogContext
fn clone(&self) -> LogContext
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for LogContext
impl Debug for LogContext
Source§impl Default for LogContext
impl Default for LogContext
Source§fn default() -> LogContext
fn default() -> LogContext
Returns the “default value” for a type. Read more
Source§impl LogContextExt for LogContext
impl LogContextExt for LogContext
Auto Trait Implementations§
impl !RefUnwindSafe for LogContext
impl !UnwindSafe for LogContext
impl Freeze for LogContext
impl Send for LogContext
impl Sync for LogContext
impl Unpin for LogContext
impl UnsafeUnpin for LogContext
Blanket Implementations§
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
Mutably borrows from an owned value. Read more