Browse Source

Change all println's to rather use the logging framework.

wip
Titouan Rigoudy 9 years ago
parent
commit
acf7e27d18
2 changed files with 9 additions and 11 deletions
  1. +1
    -1
      src/main.rs
  2. +8
    -10
      src/server.rs

+ 1
- 1
src/main.rs View File

@ -33,7 +33,7 @@ fn main() {
let host = config::SERVER_HOST;
let port = config::SERVER_PORT;
let stream = connect(host, port).unwrap();
println!("Connected to {}:{}", host, port);
info!("Connected to {}:{}", host, port);
let mut event_loop = EventLoop::new().unwrap();


+ 8
- 10
src/server.rs View File

@ -40,7 +40,7 @@ impl ServerConnection {
pub fn server_writable(&mut self) {
match self.state {
State::NotLoggedIn => {
println!("Logging in...");
info!("Logging in...");
self.state = State::LoggingIn;
self.server_interest = EventSet::readable();
let request = ServerRequest::LoginRequest(LoginRequest::new(
@ -79,7 +79,7 @@ impl ServerConnection {
self.handle_room_list_response(room_list_response),
ServerResponse::UnknownResponse(code, _) =>
println!("Unknown packet code {}", code),
warn!("Unknown packet code {}", code),
}
}
@ -99,18 +99,17 @@ impl ServerConnection {
LoginResponse::LoginOk { motd, ip, password_md5_opt } => {
self.state = State::LoggedIn;
println!("Login successful!");
println!("MOTD: \"{}\"", motd);
println!("IP address: {}", ip);
info!("Login successful!");
info!("MOTD: \"{}\"", motd);
info!("External IP address: {}", ip);
match password_md5_opt {
Some(password_md5) => {
println!("Password MD5: \"{}\"", password_md5);
println!(concat!(
info!(concat!(
"Connected to official server ",
"as official client"));
},
None => println!(concat!(
None => info!(concat!(
"Connected to official server ",
"as unofficial client")),
}
@ -118,8 +117,7 @@ impl ServerConnection {
LoginResponse::LoginFail { reason } => {
self.state = State::NotLoggedIn;
println!("Login failed!");
println!("Reason: {}", reason);
error!("Login failed: \"{}\"", reason);
}
}
},


Loading…
Cancel
Save