From 16fde4fd82f7f18e99126dc1c2031f975ff9f680 Mon Sep 17 00:00:00 2001 From: Nikita Podvirnyi Date: Sun, 21 Jul 2024 06:54:11 +0200 Subject: [PATCH] feat: explicit `game.log` file writes to avoid logs buffering in RAM --- src/games/genshin/game.rs | 6 ++++++ src/games/honkai/game.rs | 6 ++++++ src/games/pgr/game.rs | 6 ++++++ src/games/star_rail/game.rs | 6 ++++++ src/games/wuwa/game.rs | 6 ++++++ src/games/zzz/game.rs | 6 ++++++ 6 files changed, 36 insertions(+) diff --git a/src/games/genshin/game.rs b/src/games/genshin/game.rs index 91e6205..8fc043b 100644 --- a/src/games/genshin/game.rs +++ b/src/games/genshin/game.rs @@ -335,6 +335,9 @@ pub fn run() -> anyhow::Result<()> { break; } } + + // Flush written lines + game_output.flush()?; } } @@ -357,6 +360,9 @@ pub fn run() -> anyhow::Result<()> { break; } } + + // Flush written lines + game_output.flush()?; } } diff --git a/src/games/honkai/game.rs b/src/games/honkai/game.rs index cf129b2..5ede334 100644 --- a/src/games/honkai/game.rs +++ b/src/games/honkai/game.rs @@ -288,6 +288,9 @@ pub fn run() -> anyhow::Result<()> { break; } } + + // Flush written lines + game_output.flush()?; } } @@ -310,6 +313,9 @@ pub fn run() -> anyhow::Result<()> { break; } } + + // Flush written lines + game_output.flush()?; } } diff --git a/src/games/pgr/game.rs b/src/games/pgr/game.rs index 8b7d3b1..ed12329 100644 --- a/src/games/pgr/game.rs +++ b/src/games/pgr/game.rs @@ -278,6 +278,9 @@ pub fn run() -> anyhow::Result<()> { break; } } + + // Flush written lines + game_output.flush()?; } } @@ -300,6 +303,9 @@ pub fn run() -> anyhow::Result<()> { break; } } + + // Flush written lines + game_output.flush()?; } } diff --git a/src/games/star_rail/game.rs b/src/games/star_rail/game.rs index d28314a..ece337e 100644 --- a/src/games/star_rail/game.rs +++ b/src/games/star_rail/game.rs @@ -289,6 +289,9 @@ pub fn run() -> anyhow::Result<()> { break; } } + + // Flush written lines + game_output.flush()?; } } @@ -311,6 +314,9 @@ pub fn run() -> anyhow::Result<()> { break; } } + + // Flush written lines + game_output.flush()?; } } diff --git a/src/games/wuwa/game.rs b/src/games/wuwa/game.rs index 420281d..cd22ff6 100644 --- a/src/games/wuwa/game.rs +++ b/src/games/wuwa/game.rs @@ -269,6 +269,9 @@ pub fn run() -> anyhow::Result<()> { break; } } + + // Flush written lines + game_output.flush()?; } } @@ -291,6 +294,9 @@ pub fn run() -> anyhow::Result<()> { break; } } + + // Flush written lines + game_output.flush()?; } } diff --git a/src/games/zzz/game.rs b/src/games/zzz/game.rs index 56b5be5..2f5420c 100644 --- a/src/games/zzz/game.rs +++ b/src/games/zzz/game.rs @@ -287,6 +287,9 @@ pub fn run() -> anyhow::Result<()> { break; } } + + // Flush written lines + game_output.flush()?; } } @@ -309,6 +312,9 @@ pub fn run() -> anyhow::Result<()> { break; } } + + // Flush written lines + game_output.flush()?; } }