From 39066900773e7857faf2d02e7ed51b71d219d97d Mon Sep 17 00:00:00 2001 From: godosa Date: Tue, 6 Oct 2026 23:39:36 +0200 Subject: godosa-engine: initial public history --- src/Godosa.Core/Diagnostics/EngineDebug.cs | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) create mode 100644 src/Godosa.Core/Diagnostics/EngineDebug.cs (limited to 'src/Godosa.Core/Diagnostics/EngineDebug.cs') diff --git a/src/Godosa.Core/Diagnostics/EngineDebug.cs b/src/Godosa.Core/Diagnostics/EngineDebug.cs new file mode 100644 index 0000000..3cad819 --- /dev/null +++ b/src/Godosa.Core/Diagnostics/EngineDebug.cs @@ -0,0 +1,25 @@ +namespace Godosa.Core.Diagnostics; + +/// The lib's own debug categories (input, script, audio), read +/// from the game's variable: call first in Main, before any lib +/// code runs. Gate each call on its flag so disabled logging costs one bool check and no +/// string formatting. +public static class EngineDebug +{ + public static bool Input { get; private set; } + public static bool Script { get; private set; } + public static bool Audio { get; private set; } + + public static void Configure(string environmentVariable) => + Apply(new DebugFlags(Environment.GetEnvironmentVariable(environmentVariable))); + + public static void Apply(DebugFlags flags) + { + Input = flags.On("input"); + Script = flags.On("script"); + Audio = flags.On("audio"); + } + + public static void Write(string category, string message) => + Console.Error.WriteLine($"[{category}] {message}"); +} -- cgit