send data log message
This commit is contained in:
parent
ff97bcc18c
commit
15b865a803
|
@ -36,7 +36,8 @@ impl Logger {
|
|||
// -----------------------------------------------------------------------------------
|
||||
|
||||
pub async fn debug_msg<S: AsRef<str>>(&mut self, what: S) {
|
||||
self.log_payload(LogPayload::Debug { what: what.as_ref() }).await
|
||||
let what = what.as_ref();
|
||||
self.log_payload(LogPayload::Debug { what }).await
|
||||
}
|
||||
|
||||
pub async fn bound(&mut self, port: u16) {
|
||||
|
@ -51,6 +52,10 @@ impl Logger {
|
|||
pub async fn recv_data_ignored(&mut self) {
|
||||
self.log_payload(LogPayload::RecvDataIgnored).await
|
||||
}
|
||||
|
||||
pub async fn send_data(&mut self, start: usize, len: usize) {
|
||||
self.log_payload(LogPayload::SendData { start, len }).await
|
||||
}
|
||||
}
|
||||
|
||||
struct LogMessage<'a> {
|
||||
|
@ -71,6 +76,10 @@ enum LogPayload<'a> {
|
|||
order: AcceptedOrder,
|
||||
},
|
||||
RecvDataIgnored,
|
||||
SendData {
|
||||
start: usize,
|
||||
len: usize,
|
||||
},
|
||||
}
|
||||
|
||||
#[derive(Copy, Clone, Eq, PartialEq)]
|
||||
|
@ -97,6 +106,7 @@ impl Display for LogPayload<'_> {
|
|||
write!(f, "[recv data] {} ({}) ACCEPTED ({})", start, len, order)
|
||||
}
|
||||
LogPayload::RecvDataIgnored => write!(f, "[recv data] IGNORED"),
|
||||
LogPayload::SendData { start, len } => write!(f, "[send data] {} ({})", start, len),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue