From b128b93be6bc7a0b755bb74d85dcf084b4c57ce4 Mon Sep 17 00:00:00 2001 From: Moritz Hoffmann Date: Mon, 13 Jan 2025 09:43:41 +0100 Subject: [PATCH] Do not track dirty state in logger We don't regularly drop the inner logger, so one additional flush doesn't justify the added complexity. Signed-off-by: Moritz Hoffmann --- logging/src/lib.rs | 13 +------------ 1 file changed, 1 insertion(+), 12 deletions(-) diff --git a/logging/src/lib.rs b/logging/src/lib.rs index ec678647b..5f8c405f8 100644 --- a/logging/src/lib.rs +++ b/logging/src/lib.rs @@ -113,9 +113,6 @@ struct LoggerInner Logger { offset, action, builder: CB::default(), - dirty: false, }; let inner = Rc::new(RefCell::new(inner)); Logger { inner } @@ -243,7 +239,6 @@ impl)> Drop for LoggerInner { fn drop(&mut self) { - // Avoid sending out empty buffers just because of drops. - if self.dirty { - self.flush(); - } + self.flush(); } } @@ -293,7 +283,6 @@ where f.debug_struct("LoggerInner") .field("time", &self.time) .field("offset", &self.offset) - .field("dirty", &self.dirty) .field("action", &"FnMut") .field("builder", &self.builder) .finish()