pub struct CustomLogger<D, I, W, E>where
D: Fn(&str, &LogInfo) + Send + Sync,
I: Fn(&str, &LogInfo) + Send + Sync,
W: Fn(&str, &LogInfo) + Send + Sync,
E: Fn(&str, &LogInfo) + Send + Sync,{ /* private fields */ }Expand description
A custom logger that delegates to user-provided closures.
This struct allows users to provide custom logging behavior without
implementing the sealed Logger trait directly. Each log level can
have its own closure for handling log messages.
§Example
use durable_execution_sdk::context::{custom_logger, LogInfo};
use std::sync::Arc;
// Create a custom logger that prints to stdout
let logger = custom_logger(
|msg, info| println!("[DEBUG] {}: {:?}", msg, info),
|msg, info| println!("[INFO] {}: {:?}", msg, info),
|msg, info| println!("[WARN] {}: {:?}", msg, info),
|msg, info| println!("[ERROR] {}: {:?}", msg, info),
);Trait Implementations§
Source§impl<D, I, W, E> Debug for CustomLogger<D, I, W, E>
impl<D, I, W, E> Debug for CustomLogger<D, I, W, E>
Source§impl<D, I, W, E> Logger for CustomLogger<D, I, W, E>
impl<D, I, W, E> Logger for CustomLogger<D, I, W, E>
Auto Trait Implementations§
impl<D, I, W, E> Freeze for CustomLogger<D, I, W, E>
impl<D, I, W, E> RefUnwindSafe for CustomLogger<D, I, W, E>
impl<D, I, W, E> Send for CustomLogger<D, I, W, E>
impl<D, I, W, E> Sync for CustomLogger<D, I, W, E>
impl<D, I, W, E> Unpin for CustomLogger<D, I, W, E>
impl<D, I, W, E> UnsafeUnpin for CustomLogger<D, I, W, E>
impl<D, I, W, E> UnwindSafe for CustomLogger<D, I, W, E>
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
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§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>
Converts
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>
Converts
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 moreCreates a shared type from an unshared type.