Sort out some logging problems

This commit is contained in:
Martin Barksten
2016-09-20 19:02:02 +02:00
parent 5b65df2596
commit 4c83cc4b4a
5 changed files with 9 additions and 21 deletions

View File

@ -111,7 +111,7 @@ fn route_msg(client: &mut Client, str_msg: &String) -> Result<(), ClientError> {
info!(target: LOG_TARGET, "Watch game at {}", msg.url);
},
Inbound::UnrecognizedMessage => {
error!(target: LOG_TARGET, "Received unrecognized message {:?}", str_msg);
}
};

View File

@ -17,7 +17,7 @@ pub const PLAYER_REGISTERED: &'static str =
pub const INVALID_PLAYER_NAME: &'static str =
"se.cygni.snake.api.exception.InvalidPlayerName";
pub const HEART_BEAT_RESPONSE: &'static str =
"se.cygni.snake.api.request.HeartBeatResponse";
"se.cygni.snake.api.response.HeartBeatResponse";
pub const GAME_LINK_EVENT: &'static str =
"se.cygni.snake.api.event.GameLinkEvent";

View File

@ -17,14 +17,14 @@ impl Snake {
}
pub fn get_next_move(&self, msg: &MapUpdate) -> Direction {
info!(target: LOG_TARGET, "Game map updated, tick: {}", msg.gameTick);
debug!(target: LOG_TARGET, "Game map updated, tick: {}", msg.gameTick);
let ref map = msg.map;
let player_id = &msg.receivingPlayerId;
let snake = map.get_snake_by_id(player_id).unwrap();
info!(target: LOG_TARGET, "Food can be found at {:?}", translate_positions(&map.foodPositions, map.width));
info!(target: LOG_TARGET, "My snake positions are {:?}", translate_positions(&snake.positions, map.width));
debug!(target: LOG_TARGET, "Food can be found at {:?}", translate_positions(&map.foodPositions, map.width));
debug!(target: LOG_TARGET, "My snake positions are {:?}", translate_positions(&snake.positions, map.width));
let direction = if map.can_snake_move_in_direction(snake, Direction::Down) {
Direction::Down
@ -44,15 +44,15 @@ impl Snake {
}
pub fn on_game_ended(&self, msg: &GameEnded) {
info!(target: LOG_TARGET, "Game ended, the winner is: {:?}", msg.playerWinnerId);
debug!(target: LOG_TARGET, "Game ended, the winner is: {:?}", msg.playerWinnerId);
}
pub fn on_tournament_ended(&self, msg: &TournamentEnded) {
info!(target: LOG_TARGET, "Game ended, the winner is: {:?}", msg.playerWinnerId);
debug!(target: LOG_TARGET, "Game ended, the winner is: {:?}", msg.playerWinnerId);
}
pub fn on_snake_dead(&self, msg: &SnakeDead) {
info!(target: LOG_TARGET, "The snake died, reason was: {:?}", msg.deathReason);
debug!(target: LOG_TARGET, "The snake died, reason was: {:?}", msg.deathReason);
}
pub fn on_game_starting(&self, _: &GameStarting) {

View File

@ -142,8 +142,6 @@ pub struct TournamentEnded {
#[derive(Serialize, Deserialize, Debug)]
pub struct Map {
#[serde(rename="type")]
pub type_: String,
pub width: i32,
pub height: i32,
pub worldTick: u32,