Pretty-print trace messages

This commit is contained in:
Roderick van Domburg 2021-12-11 20:45:08 +01:00
parent e748d543e9
commit 9a31aa0362
No known key found for this signature in database
GPG key ID: A9EF5222A26F0451
4 changed files with 5 additions and 5 deletions

View file

@ -620,7 +620,7 @@ impl SpircTask {
} }
fn handle_user_attributes_update(&mut self, update: UserAttributesUpdate) { fn handle_user_attributes_update(&mut self, update: UserAttributesUpdate) {
trace!("Received attributes update: {:?}", update); trace!("Received attributes update: {:#?}", update);
let attributes: UserAttributes = update let attributes: UserAttributes = update
.get_pairs() .get_pairs()
.iter() .iter()

View file

@ -279,7 +279,7 @@ impl Session {
} }
} }
trace!("Received product info: {:?}", user_attributes); trace!("Received product info: {:#?}", user_attributes);
Self::check_catalogue(&user_attributes); Self::check_catalogue(&user_attributes);
self.0.data.write().unwrap().user_data.attributes = user_attributes; self.0.data.write().unwrap().user_data.attributes = user_attributes;
@ -291,7 +291,7 @@ impl Session {
| Some(LicenseVersion) => {} | Some(LicenseVersion) => {}
_ => { _ => {
if let Some(packet_type) = PacketType::from_u8(cmd) { if let Some(packet_type) = PacketType::from_u8(cmd) {
trace!("Ignoring {:?} packet with data {:?}", packet_type, data); trace!("Ignoring {:?} packet with data {:#?}", packet_type, data);
} else { } else {
trace!("Ignoring unknown packet {:x}", cmd); trace!("Ignoring unknown packet {:x}", cmd);
} }

View file

@ -87,7 +87,7 @@ impl TokenProvider {
.expect("No tokens received") .expect("No tokens received")
.to_vec(); .to_vec();
let token = Token::new(String::from_utf8(data).unwrap()).map_err(|_| MercuryError)?; let token = Token::new(String::from_utf8(data).unwrap()).map_err(|_| MercuryError)?;
trace!("Got token: {:?}", token); trace!("Got token: {:#?}", token);
self.lock(|inner| inner.tokens.push(token.clone())); self.lock(|inner| inner.tokens.push(token.clone()));
Ok(token) Ok(token)
} }

View file

@ -50,7 +50,7 @@ pub trait Metadata: Send + Sized + 'static {
async fn get(session: &Session, id: SpotifyId) -> Result<Self, MetadataError> { async fn get(session: &Session, id: SpotifyId) -> Result<Self, MetadataError> {
let response = Self::request(session, id).await?; let response = Self::request(session, id).await?;
let msg = Self::Message::parse_from_bytes(&response)?; let msg = Self::Message::parse_from_bytes(&response)?;
trace!("Received metadata: {:?}", msg); trace!("Received metadata: {:#?}", msg);
Self::parse(&msg, id) Self::parse(&msg, id)
} }