#[non_exhaustive]pub struct LogContextGuard<'a> { /* private fields */ }
Expand description
A guard representing a current logging context in the context stack.
When the guard is dropped, the context is automatically removed from the stack.
This is returned by the LogContext::enter
method.
§Examples
use context_logger::LogContext;
// Create a context with some data
let context = LogContext::new().record("user_id", 123);
// Enter the context (pushes to stack)
let guard = context.enter();
// Log operations here will have access to the context
// ...
// When `guard` goes out of scope, the context is automatically removed
Trait Implementations§
Source§impl<'a> Debug for LogContextGuard<'a>
impl<'a> Debug for LogContextGuard<'a>
Auto Trait Implementations§
impl<'a> Freeze for LogContextGuard<'a>
impl<'a> RefUnwindSafe for LogContextGuard<'a>
impl<'a> !Send for LogContextGuard<'a>
impl<'a> !Sync for LogContextGuard<'a>
impl<'a> Unpin for LogContextGuard<'a>
impl<'a> UnwindSafe for LogContextGuard<'a>
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