pub struct Logger { /* private fields */ }logging only.Expand description
Logging utility for dnet transports.
Implementations§
Source§impl Logger
impl Logger
Sourcepub fn new_for_already_named<T>(transport_name: &str) -> Selfwhere
T: Logging,
pub fn new_for_already_named<T>(transport_name: &str) -> Selfwhere
T: Logging,
Create new logger for transport that already has a name.
Usually dnet transports don’t have names, but when they do
you may use this constructor to make transport’s logical name the
same as the one used for logging purposes.
Note that logging name may still be changed later by the transport user and at that point logical name and logging name may be different.
Sourcepub fn log_open_success(&self)
pub fn log_open_success(&self)
Log that the transport was opened successfully.
Note: not all transports emit an “open” event — transports that do not wait for an explicit open should skip calling this.
Sourcepub fn log_open_failure(&self, error: impl Error)
pub fn log_open_failure(&self, error: impl Error)
Log that opening the transport failed.
Useful for transports that report an explicit open failure to the application. Transports that don’t wait for opening can ignore this.
Sourcepub fn log_ready<S, F>(&self, result: &Poll<Result<S, F>>)where
F: Error,
pub fn log_ready<S, F>(&self, result: &Poll<Result<S, F>>)where
F: Error,
Helper method for logging readiness based on result.
See log_ready_success and log_ready_failure for more details.
Sourcepub fn log_ready_success(&self)
pub fn log_ready_success(&self)
Log that the transport is ready for sending messages.
Currently this does not log anything to keep the log less verbose, but it may be changed in the future.
Sourcepub fn log_ready_failure(&self, error: impl Error)
pub fn log_ready_failure(&self, error: impl Error)
Log that the transport failed to become ready for sending messages.
Sourcepub fn log_message_staging<O, S, F>(&self, result: &Result<S, F>)where
F: Error,
pub fn log_message_staging<O, S, F>(&self, result: &Result<S, F>)where
F: Error,
Helper method for logging message staging based on result.
See log_message_staging_success and log_message_staging_failure for more info.
Sourcepub fn log_message_staging_success<O>(&self)
pub fn log_message_staging_success<O>(&self)
Log successful staging of an outgoing message for sending.
Used by transports that stage outgoing messages by putting them into buffer before encoding and sending. Not every transport stages messages before sending - this method may be unused.
Sourcepub fn log_message_staging_failure(&self, error: impl Error)
pub fn log_message_staging_failure(&self, error: impl Error)
Log failure while staging an outgoing message for sending.
Used by transports that stage outgoing messages by putting them into buffer before encoding and sending. Not every transport stages messages before sending - this method may be unused.
Sourcepub fn log_message_preparation<O, S, F>(
&self,
send_buffer_len_before: usize,
send_buffer_len_after: usize,
result: &Result<S, F>,
)where
F: Error,
pub fn log_message_preparation<O, S, F>(
&self,
send_buffer_len_before: usize,
send_buffer_len_after: usize,
result: &Result<S, F>,
)where
F: Error,
Helper method for logging message preparation based on result.
See log_message_preparation_success and log_message_preparation_failure for more info.
Sourcepub fn log_message_preparation_success<O>(&self, size: Option<usize>)
pub fn log_message_preparation_success<O>(&self, size: Option<usize>)
Log successful preparation of an outgoing message.
Used by transports that buffer or prepare messages before sending (flushing). Not every transport buffers messages before sending.
Sourcepub fn log_message_preparation_failure(&self, error: impl Error)
pub fn log_message_preparation_failure(&self, error: impl Error)
Log failure while preparing an outgoing message.
Used by buffered transports that perform message preparation steps before sending (flushing); may be unused by simpler transports.
Sourcepub fn log_sending<O, F>(&self, result: &Result<(), F>, size: Option<usize>)where
F: Error,
pub fn log_sending<O, F>(&self, result: &Result<(), F>, size: Option<usize>)where
F: Error,
Helper method for logging message sending based on result.
See log_sending_success and log_sending_failure for more info.
Sourcepub fn log_sending_success<O>(&self, size: Option<usize>)
pub fn log_sending_success<O>(&self, size: Option<usize>)
Log that a message was sent successfully.
Sourcepub fn log_sending_failure(&self, error: impl Error)
pub fn log_sending_failure(&self, error: impl Error)
Log that sending a message failed.
Sourcepub fn log_message_arrived_unknown(&self, size: Option<usize>)
pub fn log_message_arrived_unknown(&self, size: Option<usize>)
Log that a message data arrived (was received and enqueued).
This is used by transports that receive messages data in the background and place them into a buffer for later deserialization and consumption; not all transports will use arrival logs.
It is called “unknown” because at this point we don’t know if message deserialization will succeed or not.
Sourcepub fn log_message_arrived_success<I>(&self, _item: &I, size: Option<usize>)
pub fn log_message_arrived_success<I>(&self, _item: &I, size: Option<usize>)
Log that a message arrived (was received and enqueued).
This is used by transports that receive messages in the background and place them into a buffer for later consumption; not all transports will use arrival logs.
Sourcepub fn log_message_arrived_failure(&self, error: impl Error)
pub fn log_message_arrived_failure(&self, error: impl Error)
Log failure during background arrival/enqueue of a received message.
Relevant for transports that buffer incoming messages in the background;
may be unused by transports that only receive message while precessing
next method.
Sourcepub fn log_receiving<I, F>(
&self,
result: &Poll<Option<Result<I, F>>>,
message_length: Option<usize>,
)where
F: Error,
pub fn log_receiving<I, F>(
&self,
result: &Poll<Option<Result<I, F>>>,
message_length: Option<usize>,
)where
F: Error,
Helper method for logging receiving based on result.
See log_receiving_success, log_receiving_failure and log_remote_closed for more info.
Sourcepub fn log_receiving_success<I>(&self, _item: &I, size: Option<usize>)
pub fn log_receiving_success<I>(&self, _item: &I, size: Option<usize>)
Log that a message was successfully received.
Sourcepub fn log_receiving_failure(&self, error: impl Error)
pub fn log_receiving_failure(&self, error: impl Error)
Log that receiving a message failed.
Sourcepub fn log_receive_from_void(&self)
pub fn log_receive_from_void(&self)
Log that an attempt to receive from a Void transport was made.
Sourcepub fn log_flush<S, F>(&self, result: &Poll<Result<S, F>>)where
F: Error,
pub fn log_flush<S, F>(&self, result: &Poll<Result<S, F>>)where
F: Error,
Helper method for logging flush.
See log_flush_success and log_flush_failure for more info.
Sourcepub fn log_flush_success(&self)
pub fn log_flush_success(&self)
Log that buffered messages were flushed successfully.
Sourcepub fn log_flush_failure(&self, error: impl Error)
pub fn log_flush_failure(&self, error: impl Error)
Log that flushing buffered messages failed.
Sourcepub fn log_close<S, F>(&self, result: &Poll<Result<S, F>>)where
F: Error,
pub fn log_close<S, F>(&self, result: &Poll<Result<S, F>>)where
F: Error,
Helper method for logging closing of the transport based on result.
See log_closed_success, log_closed_failure for more info.
Sourcepub fn log_closed_success(&self)
pub fn log_closed_success(&self)
Log that the transport was closed locally successfully.
Sourcepub fn log_closed_failure(&self, error: impl Error)
pub fn log_closed_failure(&self, error: impl Error)
Log that closing the transport locally failed.
Sourcepub fn log_remote_closed(&self)
pub fn log_remote_closed(&self)
Log that the remote peer closed the transport.
Sourcepub fn log_incoming_filtered_out<I>(&self)
pub fn log_incoming_filtered_out<I>(&self)
Log that an incoming message was filtered out.
Sourcepub fn log_outgoing_filtered_out<I>(&self)
pub fn log_outgoing_filtered_out<I>(&self)
Log that an outgoing message was filtered out.
Sourcepub fn set_transport_name(&mut self, name: Option<String>)
pub fn set_transport_name(&mut self, name: Option<String>)
Set transport name for logging purposes.
Sourcepub fn get_transport_name(&self) -> Option<&str>
pub fn get_transport_name(&self) -> Option<&str>
Get transport name for logging purposes.
Sourcepub fn is_enabled(&self) -> bool
pub fn is_enabled(&self) -> bool
Is logging enabled.
Sourcepub fn override_kind<T>(&mut self)where
T: Logging,
pub fn override_kind<T>(&mut self)where
T: Logging,
Override existing logger kind with another transport type kind.
Sourcepub fn override_kind_with_str(&mut self, kind: &str)
pub fn override_kind_with_str(&mut self, kind: &str)
Override existing logger kind with provided string.
Sourcepub fn override_kind_buffered<T>(&mut self)where
T: Logging,
pub fn override_kind_buffered<T>(&mut self)where
T: Logging,
Override existing logger kind with another (buffered) transport type kind.
Sourcepub fn override_kind_part<T>(&mut self, variant: usize)where
T: Logging,
pub fn override_kind_part<T>(&mut self, variant: usize)where
T: Logging,
Override existing logger kind with another (part) transport type kind.