Fixed misslabeling of info as error, added even more logging

This commit is contained in:
famfo 2021-12-22 20:10:22 +01:00
parent 228886c79d
commit 9a58a874dc

View file

@ -122,21 +122,25 @@ async fn connection_handler(
match msg {
BroadcastMessage::MSG(nick, msg, sender) => {
if sender != id {
tracing::info!("{} {}", nick, msg);
tx.write_all(format!("{} {}", nick, msg).as_bytes()).await?;
}
},
BroadcastMessage::NICK(old_nick, new_nick, sender) => {
if sender != id {
tracing::info!("{} changed to {}", old_nick, new_nick);
tx.write_all(format!("{} NICK {}\n", old_nick, new_nick).as_bytes()).await?;
}
},
BroadcastMessage::JOIN(sender) => {
if sender != nick {
tracing::info!("{} joined", sender);
tx.write_all(format!("JOIN {}\n", sender).as_bytes()).await?;
}
},
BroadcastMessage::LEAVE(sender) => {
if sender != nick {
tracing::info!("{} left", sender);
tx.write_all(format!("LEAVE {}\n", sender).as_bytes()).await?;
}
},
@ -146,13 +150,13 @@ async fn connection_handler(
let msg = o?;
match msg {
ClientMessage::ERR(msg) => {
tracing::error!("MSG ERR: {}", msg);
tracing::error!("ERR: {}", msg);
tx.write_all(format!("ERR {}\n", msg).as_bytes()).await?;
},
ClientMessage::LIST(list) => {
let names = list.join(" ");
tracing::error!("LIST ERR: {}", names);
tracing::info!("LIST: {}", names);
tx.write_all(format!("LIST {}\n", names).as_bytes()).await?;
}
}