Adds colored logs for when a client connects or disconnects
This commit is contained in:
parent
6e44faedd5
commit
25cbf4d2f2
@ -53,7 +53,11 @@ fn main() -> std::io::Result<()> {
|
||||
Ok(())
|
||||
}
|
||||
|
||||
use colored::*; // Add this at the top of your file
|
||||
|
||||
fn handle_client(mut client: TcpStream, target: &str, client_id: usize) -> std::io::Result<()> {
|
||||
println!("{}", format!("Client {} connected", client_id).green());
|
||||
|
||||
let mut server = TcpStream::connect(target)?;
|
||||
let timestamp = SystemTime::now()
|
||||
.duration_since(SystemTime::UNIX_EPOCH)
|
||||
@ -80,6 +84,7 @@ fn handle_client(mut client: TcpStream, target: &str, client_id: usize) -> std::
|
||||
client_to_server.join().unwrap()?;
|
||||
server_to_client.join().unwrap()?;
|
||||
|
||||
println!("{}", format!("Client {} disconnected", client_id).red());
|
||||
Ok(())
|
||||
}
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user