Log full packets under different target
This commit is contained in:
parent
a0d55482cc
commit
dfacc05749
1 changed files with 5 additions and 6 deletions
11
src/conn.rs
11
src/conn.rs
|
|
@ -408,7 +408,7 @@ impl Conn {
|
||||||
match msg {
|
match msg {
|
||||||
tungstenite::Message::Text(text) => {
|
tungstenite::Message::Text(text) => {
|
||||||
let packet = serde_json::from_str(&text)?;
|
let packet = serde_json::from_str(&text)?;
|
||||||
debug!("Received {packet:?}");
|
debug!(target: "euphoxide::conn::full", "Received {packet:?}");
|
||||||
let packet = ParsedPacket::from_packet(packet)?;
|
let packet = ParsedPacket::from_packet(packet)?;
|
||||||
self.on_packet(&packet).await?;
|
self.on_packet(&packet).await?;
|
||||||
return Ok(Some(packet));
|
return Ok(Some(packet));
|
||||||
|
|
@ -547,7 +547,7 @@ impl Conn {
|
||||||
throttled: None,
|
throttled: None,
|
||||||
}
|
}
|
||||||
.into_packet()?;
|
.into_packet()?;
|
||||||
debug!("Sending {packet:?}");
|
debug!(target: "euphoxide::conn::full", "Sending {packet:?}");
|
||||||
|
|
||||||
let msg = tungstenite::Message::Text(serde_json::to_string(&packet)?);
|
let msg = tungstenite::Message::Text(serde_json::to_string(&packet)?);
|
||||||
self.ws.send(msg).await?;
|
self.ws.send(msg).await?;
|
||||||
|
|
@ -565,7 +565,7 @@ impl Conn {
|
||||||
throttled: None,
|
throttled: None,
|
||||||
}
|
}
|
||||||
.into_packet()?;
|
.into_packet()?;
|
||||||
debug!("Sending {packet:?}");
|
debug!(target: "euphoxide::conn::full", "Sending {packet:?}");
|
||||||
|
|
||||||
let msg = tungstenite::Message::Text(serde_json::to_string(&packet)?);
|
let msg = tungstenite::Message::Text(serde_json::to_string(&packet)?);
|
||||||
self.ws.send(msg).await?;
|
self.ws.send(msg).await?;
|
||||||
|
|
@ -574,9 +574,8 @@ impl Conn {
|
||||||
}
|
}
|
||||||
|
|
||||||
async fn disconnect(&mut self) -> Result<Infallible> {
|
async fn disconnect(&mut self) -> Result<Infallible> {
|
||||||
// TODO Maybe timeout this
|
let _ = tokio::time::timeout(self.replies.timeout(), self.ws.close(None)).await;
|
||||||
let _ = self.ws.close(None).await;
|
debug!("Closed connection");
|
||||||
debug!("Closed connection gracefully");
|
|
||||||
Err(Error::ConnectionClosed)
|
Err(Error::ConnectionClosed)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue