From: Ian Jackson Date: Sat, 22 Aug 2020 18:02:10 +0000 (+0100) Subject: conditional logs X-Git-Tag: otter-0.2.0~1109 X-Git-Url: https://www.chiark.greenend.org.uk/ucgi/~ianmdlvl/git?a=commitdiff_plain;h=435622df26f493520b2b1d5c01e1227a9df88536;p=otter.git conditional logs --- diff --git a/src/cmdlistener.rs b/src/cmdlistener.rs index 21ea5af2..dbf9dc50 100644 --- a/src/cmdlistener.rs +++ b/src/cmdlistener.rs @@ -261,6 +261,7 @@ fn execute(cs: &mut CommandStream, cmd: MgmtCommand) -> MgmtResponse { #[derive(Debug,Default)] struct UpdateHandlerBulk { pieces : slotmap::SparseSecondaryMap>, + logs : bool, } #[derive(Debug)] @@ -299,7 +300,7 @@ impl UpdateHandler { None => { bulk.pieces.remove(upiece); }, }; } - let _logs = ulogs; + bulk.logs |= ulogs.len() != 0; }, Online => { let estimate = upieces.len() + ulogs.len(); @@ -324,11 +325,13 @@ impl UpdateHandler { buf.piece_update(upiece, uuop, &lens); } - buf.log_updates(vec![LogEntry { - html: "The facilitator (re)configured the game".to_owned(), - // xxx use cs.desc - }]); - }, + if bulk.logs { + buf.log_updates(vec![LogEntry { + html: "The facilitator (re)configured the game".to_owned(), + // xxx use cs.desc + }]); + } + }, Online => { }, } }