From a2873d6380208a83bbcce0ad8d41b5bd8b52ae03 Mon Sep 17 00:00:00 2001 From: 13xforever Date: Wed, 3 Dec 2025 04:01:19 +0500 Subject: [PATCH] do not spam pipe debug logs in release configuration --- CompatBot/Commands/MessageMenuCommands.cs | 1 - .../EventHandlers/LogParsing/LogParser.PipeReader.cs | 10 ++++++++++ 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/CompatBot/Commands/MessageMenuCommands.cs b/CompatBot/Commands/MessageMenuCommands.cs index df1b0ae3..f6b4f0a9 100644 --- a/CompatBot/Commands/MessageMenuCommands.cs +++ b/CompatBot/Commands/MessageMenuCommands.cs @@ -124,7 +124,6 @@ internal static class MessageMenuCommands return; } await ctx.RespondAsync($"{Config.Reactions.Success} Message was enqueued for analysis", ephemeral: true).ConfigureAwait(false); - } /* diff --git a/CompatBot/EventHandlers/LogParsing/LogParser.PipeReader.cs b/CompatBot/EventHandlers/LogParsing/LogParser.PipeReader.cs index 83aa555e..a83ae62a 100644 --- a/CompatBot/EventHandlers/LogParsing/LogParser.PipeReader.cs +++ b/CompatBot/EventHandlers/LogParsing/LogParser.PipeReader.cs @@ -22,7 +22,9 @@ internal static partial class LogParser { result = await reader.ReadAsync(cancellationToken).ConfigureAwait(false); var buffer = result.Buffer; +#if DEBUG Config.Log.Debug($"{nameof(LogParser)}: Read {buffer.Length} bytes from reader"); +#endif if (!skippedBom) { if (buffer.Length < 3) @@ -32,7 +34,9 @@ internal static partial class LogParser if (potentialBom.ToArray().SequenceEqual(Bom)) { reader.AdvanceTo(potentialBom.End); +#if DEBUG Config.Log.Debug($"{nameof(LogParser)}: Reader advanced to {potentialBom.End} to skip BOM"); +#endif totalReadBytes += potentialBom.Length; skippedBom = true; continue; @@ -52,7 +56,9 @@ internal static partial class LogParser if (state.Error != LogParseState.ErrorCode.None) { await reader.CompleteAsync(); +#if DEBUG Config.Log.Debug($"{nameof(LogParser)}: Reader completed (error: {state.Error})"); +#endif return state; } @@ -73,7 +79,9 @@ internal static partial class LogParser var sectionStart = currentSectionLines.First is {} firstLine ? firstLine.Value : buffer; totalReadBytes += result.Buffer.Slice(0, sectionStart.Start).Length; reader.AdvanceTo(sectionStart.Start); +#if DEBUG Config.Log.Debug($"{nameof(LogParser)}: Reader advanced to {sectionStart.Start} (section start)"); +#endif } catch (Exception e) { @@ -86,7 +94,9 @@ internal static partial class LogParser await TaskScheduler.WaitForClearTagAsync(state).ConfigureAwait(false); state.ReadBytes = totalReadBytes; await reader.CompleteAsync(); +#if DEBUG Config.Log.Debug($"{nameof(LogParser)}: Reader completed"); +#endif return state; }