From 54b9694f0d0d7e853592317d60ad262ae8c13568 Mon Sep 17 00:00:00 2001 From: Ilion Beyst Date: Wed, 23 Feb 2022 21:08:56 +0100 Subject: implement matchlogger --- planetwars-matchrunner/src/pw_match.rs | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) (limited to 'planetwars-matchrunner/src/pw_match.rs') diff --git a/planetwars-matchrunner/src/pw_match.rs b/planetwars-matchrunner/src/pw_match.rs index 25f849e..c114d78 100644 --- a/planetwars-matchrunner/src/pw_match.rs +++ b/planetwars-matchrunner/src/pw_match.rs @@ -1,3 +1,5 @@ +use crate::match_log::MatchLogMessage; + use super::match_context::{MatchCtx, RequestResult}; use futures::stream::futures_unordered::FuturesUnordered; use futures::{FutureExt, StreamExt}; @@ -44,16 +46,16 @@ impl PwMatch { for (player_id, turn) in player_messages { let res = self.execute_action(player_id, turn); if let Some(err) = action_errors(res) { - let info_str = serde_json::to_string(&err).unwrap(); - println!("player {}: {}", player_id, info_str); + let _info_str = serde_json::to_string(&err).unwrap(); + // TODO + // println!("player {}: {}", player_id, info_str); } } self.match_state.step(); // Log state let state = self.match_state.serialize_state(); - self.match_ctx - .log_string(serde_json::to_string(&state).unwrap()); + self.match_ctx.log(MatchLogMessage::GameState(state)); } } -- cgit v1.2.3