diff --git a/Configuration/Instance/FileConfigInstance.cs b/Configuration/Instance/FileConfigInstance.cs index 3fca11a2..f7d14e3c 100644 --- a/Configuration/Instance/FileConfigInstance.cs +++ b/Configuration/Instance/FileConfigInstance.cs @@ -34,7 +34,7 @@ public void Load(){ LoadInternal(attempt > 0); if (firstException != null){ // silently log exception that caused a backup restore - Program.Reporter.Log(firstException.ToString()); + Program.Reporter.LogImportant(firstException.ToString()); } return; diff --git a/Configuration/LockManager.cs b/Configuration/LockManager.cs index af754de0..c6f6567d 100644 --- a/Configuration/LockManager.cs +++ b/Configuration/LockManager.cs @@ -124,7 +124,7 @@ public bool Unlock(){ try{ File.Delete(file); }catch(Exception e){ - Program.Reporter.Log(e.ToString()); + Program.Reporter.LogImportant(e.ToString()); return false; } } diff --git a/Core/Handling/RequestHandlerBase.cs b/Core/Handling/RequestHandlerBase.cs index 305e9761..e3896615 100644 --- a/Core/Handling/RequestHandlerBase.cs +++ b/Core/Handling/RequestHandlerBase.cs @@ -67,10 +67,10 @@ public override bool OnResourceResponse(IWebBrowser browserControl, IBrowser bro if (match.Success && TweetDeckHashes.TryGetValue($"{match.Groups[1]}.{match.Groups[3]}", out string hash)){ if (match.Groups[2].Value == hash){ - Program.Reporter.Log("[RequestHandlerBase] Accepting " + url); + Program.Reporter.LogVerbose("[RequestHandlerBase] Accepting " + url); } else{ - Program.Reporter.Log("[RequestHandlerBase] Replacing " + url + " hash with " + hash); + Program.Reporter.LogVerbose("[RequestHandlerBase] Replacing " + url + " hash with " + hash); request.Url = TweetDeckResourceUrl.Replace(url, $"/dist/$1.{hash}.$3"); return true; } diff --git a/Core/Management/VideoPlayer.cs b/Core/Management/VideoPlayer.cs index 17170013..4ca55440 100644 --- a/Core/Management/VideoPlayer.cs +++ b/Core/Management/VideoPlayer.cs @@ -135,7 +135,7 @@ private void owner_FormClosing(object sender, FormClosingEventArgs e){ private void process_OutputDataReceived(object sender, DataReceivedEventArgs e){ if (!string.IsNullOrEmpty(e.Data)){ - Program.Reporter.Log("[VideoPlayer] "+e.Data); + Program.Reporter.LogVerbose("[VideoPlayer] "+e.Data); } } diff --git a/Reporter.cs b/Reporter.cs index 3a563263..2f0bc90a 100644 --- a/Reporter.cs +++ b/Reporter.cs @@ -4,6 +4,7 @@ using System.IO; using System.Text; using System.Windows.Forms; +using TweetDuck.Configuration; using TweetDuck.Core.Other; namespace TweetDuck{ @@ -22,7 +23,11 @@ public void SetupUnhandledExceptionHandler(string caption){ }; } - public bool Log(string data){ + public bool LogVerbose(string data){ + return Arguments.HasFlag(Arguments.ArgLogging) && LogImportant(data); + } + + public bool LogImportant(string data){ #if DEBUG Debug.WriteLine(data); #endif @@ -45,7 +50,7 @@ public bool Log(string data){ } public void HandleException(string caption, string message, bool canIgnore, Exception e){ - bool loggedSuccessfully = Log(e.ToString()); + bool loggedSuccessfully = LogImportant(e.ToString()); string exceptionText = e is ExpandedLogException ? e.Message+"\n\nDetails with potentially sensitive information are in the Error Log." : e.Message; FormMessage form = new FormMessage(caption, message+"\nError: "+exceptionText, canIgnore ? MessageBoxIcon.Warning : MessageBoxIcon.Error);