pub struct Logger { /* private fields */ }Expand description
Unified logger that outputs to multiple backends.
Outputs to:
- tracing (stderr/file) - always
- MCP client (via peer.notify_logging_message) - if peer is set
Implementations§
Source§impl Logger
impl Logger
Sourcepub fn with_peer(self, peer: Peer<RoleServer>) -> Self
pub fn with_peer(self, peer: Peer<RoleServer>) -> Self
Set the MCP peer for client notifications.
Sourcepub fn with_level_filter(self, filter: Arc<LogLevelFilter>) -> Self
pub fn with_level_filter(self, filter: Arc<LogLevelFilter>) -> Self
Set the level filter.
Sourcepub fn log(&self, level: LoggingLevel, message: &str, data: Option<Value>)
pub fn log(&self, level: LoggingLevel, message: &str, data: Option<Value>)
Log a message to all configured endpoints.
Sourcepub fn log_with_data(&self, level: LoggingLevel, message: &str, data: Value)
pub fn log_with_data(&self, level: LoggingLevel, message: &str, data: Value)
Log a message with structured data.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Logger
impl !RefUnwindSafe for Logger
impl Send for Logger
impl Sync for Logger
impl Unpin for Logger
impl !UnwindSafe for Logger
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> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
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 more