mirror of
https://github.com/chylex/TweetDuck.git
synced 2025-04-10 18:15:44 +02:00
Add verbose logging controlled by command line flag & update existing calls
This commit is contained in:
parent
1fb133e6b8
commit
ef815dabce
@ -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;
|
||||
|
@ -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;
|
||||
}
|
||||
}
|
||||
|
@ -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;
|
||||
}
|
||||
|
@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -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);
|
||||
|
Loading…
Reference in New Issue
Block a user