1
0
mirror of https://github.com/chylex/TweetDuck.git synced 2025-05-04 17:34:07 +02:00

Add browser console logging to debug output

This commit is contained in:
chylex 2016-11-13 13:44:36 +01:00
parent 9cd00239f9
commit e8394b9c08
3 changed files with 16 additions and 0 deletions

View File

@ -8,6 +8,7 @@
using TweetDck.Resources;
using TweetDck.Core.Controls;
using System.Drawing;
using TweetDck.Core.Utils;
using TweetDck.Updates;
using TweetDck.Plugins;
using TweetDck.Plugins.Events;
@ -52,6 +53,10 @@ public FormBrowser(PluginManager pluginManager){
LifeSpanHandler = new LifeSpanHandler()
};
#if DEBUG
this.browser.ConsoleMessage += BrowserUtils.HandleConsoleMessage;
#endif
this.browser.LoadingStateChanged += Browser_LoadingStateChanged;
this.browser.FrameLoadEnd += Browser_FrameLoadEnd;
this.browser.RegisterJsObject("$TD", new TweetDeckBridge(this, notification));

View File

@ -100,6 +100,10 @@ public FormNotification(FormBrowser owner, PluginManager pluginManager, bool aut
LifeSpanHandler = new LifeSpanHandler()
};
#if DEBUG
browser.ConsoleMessage += BrowserUtils.HandleConsoleMessage;
#endif
browser.IsBrowserInitializedChanged += Browser_IsBrowserInitializedChanged;
browser.FrameLoadEnd += Browser_FrameLoadEnd;
browser.RegisterJsObject("$TD", new TweetDeckBridge(owner, this));

View File

@ -4,6 +4,7 @@
using System.IO;
using System.Net;
using System.Windows.Forms;
using CefSharp;
namespace TweetDck.Core.Utils{
static class BrowserUtils{
@ -47,5 +48,11 @@ public static void DownloadFileAsync(string url, string target, Action<Exception
client.DownloadFileAsync(new Uri(url), target);
}
#if DEBUG
public static void HandleConsoleMessage(object sender, ConsoleMessageEventArgs e){
Debug.WriteLine("[Console] {0} ({1}:{2})", e.Message, e.Source, e.Line);
}
#endif
}
}