diff --git a/ArchiSteamFarm/Bot.cs b/ArchiSteamFarm/Bot.cs index a49398f80..f2c2fb15d 100755 --- a/ArchiSteamFarm/Bot.cs +++ b/ArchiSteamFarm/Bot.cs @@ -771,7 +771,10 @@ namespace ArchiSteamFarm { TimeSpan timeSpan = TimeSpan.FromMilliseconds(CallbackSleep); while (KeepRunning || SteamClient.IsConnected) { if (!CallbackSemaphore.Wait(0)) { - ArchiLogger.LogGenericDebug(string.Format(Strings.WarningFailedWithError, nameof(CallbackSemaphore))); + if (Debugging.IsUserDebugging) { + ArchiLogger.LogGenericDebug(string.Format(Strings.WarningFailedWithError, nameof(CallbackSemaphore))); + } + return; } @@ -814,7 +817,7 @@ namespace ArchiSteamFarm { HeartBeatFailures = 0; Statistics?.OnHeartBeat().Forget(); } catch (Exception e) { - if (Debugging.IsDebugBuild || Program.GlobalConfig.Debug) { + if (Debugging.IsUserDebugging) { ArchiLogger.LogGenericDebugException(e); } diff --git a/ArchiSteamFarm/Debugging.cs b/ArchiSteamFarm/Debugging.cs index a6dced9a8..3dfb694a5 100644 --- a/ArchiSteamFarm/Debugging.cs +++ b/ArchiSteamFarm/Debugging.cs @@ -35,6 +35,8 @@ namespace ArchiSteamFarm { internal static readonly bool IsDebugBuild = false; #endif + internal static bool IsUserDebugging => IsDebugBuild || Program.GlobalConfig.Debug; + internal sealed class DebugListener : IDebugListener { public void WriteLine(string category, string msg) { if (string.IsNullOrEmpty(category) && string.IsNullOrEmpty(msg)) { diff --git a/ArchiSteamFarm/WebBrowser.cs b/ArchiSteamFarm/WebBrowser.cs index 1def8c974..d0323ec4c 100644 --- a/ArchiSteamFarm/WebBrowser.cs +++ b/ArchiSteamFarm/WebBrowser.cs @@ -517,7 +517,7 @@ namespace ArchiSteamFarm { responseMessage = await HttpClient.SendAsync(requestMessage).ConfigureAwait(false); } catch (Exception e) { // This exception is really common, don't bother with it unless debug mode is enabled - if (Debugging.IsDebugBuild || Program.GlobalConfig.Debug) { + if (Debugging.IsUserDebugging) { ArchiLogger.LogGenericDebugException(e); } @@ -533,7 +533,7 @@ namespace ArchiSteamFarm { return responseMessage; } - if (Debugging.IsDebugBuild || Program.GlobalConfig.Debug) { + if (Debugging.IsUserDebugging) { ArchiLogger.LogGenericDebug(string.Format(Strings.ErrorFailingRequest, request)); ArchiLogger.LogGenericDebug(string.Format(Strings.StatusCode, responseMessage.StatusCode)); ArchiLogger.LogGenericDebug(string.Format(Strings.Content, await responseMessage.Content.ReadAsStringAsync().ConfigureAwait(false)));