From 38be769f9666611916e361fd0fcd7f0d6ed2a0e3 Mon Sep 17 00:00:00 2001 From: amaitland Date: Mon, 5 Feb 2018 17:30:44 +1000 Subject: [PATCH] OnConsoleMessage - Add LogSeverity --- CefSharp.Core/Internals/ClientAdapter.cpp | 4 ++-- CefSharp.Core/Internals/ClientAdapter.h | 2 +- CefSharp/Event/ConsoleMessageEventArgs.cs | 9 ++++++++- 3 files changed, 11 insertions(+), 4 deletions(-) diff --git a/CefSharp.Core/Internals/ClientAdapter.cpp b/CefSharp.Core/Internals/ClientAdapter.cpp index 29c27e33e7..dc30ada7a9 100644 --- a/CefSharp.Core/Internals/ClientAdapter.cpp +++ b/CefSharp.Core/Internals/ClientAdapter.cpp @@ -360,9 +360,9 @@ namespace CefSharp return returnFlag; } - bool ClientAdapter::OnConsoleMessage(CefRefPtr browser, const CefString& message, const CefString& source, int line) + bool ClientAdapter::OnConsoleMessage(CefRefPtr browser, cef_log_severity_t level, const CefString& message, const CefString& source, int line) { - auto args = gcnew ConsoleMessageEventArgs(StringUtils::ToClr(message), StringUtils::ToClr(source), line); + auto args = gcnew ConsoleMessageEventArgs((LogSeverity)level, StringUtils::ToClr(message), StringUtils::ToClr(source), line); if (!browser->IsPopup()) { diff --git a/CefSharp.Core/Internals/ClientAdapter.h b/CefSharp.Core/Internals/ClientAdapter.h index f5ec46e7da..0d4653708d 100644 --- a/CefSharp.Core/Internals/ClientAdapter.h +++ b/CefSharp.Core/Internals/ClientAdapter.h @@ -146,7 +146,7 @@ namespace CefSharp virtual DECL void OnFaviconURLChange(CefRefPtr browser, const std::vector& iconUrls) OVERRIDE; virtual DECL void OnFullscreenModeChange(CefRefPtr browser, bool fullscreen) OVERRIDE; virtual DECL bool OnTooltip(CefRefPtr browser, CefString& text) OVERRIDE; - virtual DECL bool OnConsoleMessage(CefRefPtr browser, const CefString& message, const CefString& source, int line) OVERRIDE; + virtual DECL bool OnConsoleMessage(CefRefPtr browser, cef_log_severity_t level, const CefString& message, const CefString& source, int line) OVERRIDE; virtual DECL void OnStatusMessage(CefRefPtr browser, const CefString& message) OVERRIDE; // CefContextMenuHandler diff --git a/CefSharp/Event/ConsoleMessageEventArgs.cs b/CefSharp/Event/ConsoleMessageEventArgs.cs index 73245bd36a..2f54f7ffd4 100644 --- a/CefSharp/Event/ConsoleMessageEventArgs.cs +++ b/CefSharp/Event/ConsoleMessageEventArgs.cs @@ -14,16 +14,23 @@ public class ConsoleMessageEventArgs : EventArgs /// /// Creates a new ConsoleMessageEventArgs event argument. /// + /// level /// message /// source /// line number - public ConsoleMessageEventArgs(string message, string source, int line) + public ConsoleMessageEventArgs(LogSeverity level, string message, string source, int line) { + Level = level; Message = message; Source = source; Line = line; } + /// + /// Log level + /// + public LogSeverity Level { get; private set; } + /// /// The message text of the console message. ///