Skip to content

Commit

Permalink
OnConsoleMessage - Add LogSeverity
Browse files Browse the repository at this point in the history
  • Loading branch information
amaitland committed Feb 5, 2018
1 parent a38df4a commit 38be769
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 4 deletions.
4 changes: 2 additions & 2 deletions CefSharp.Core/Internals/ClientAdapter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -360,9 +360,9 @@ namespace CefSharp
return returnFlag;
}

bool ClientAdapter::OnConsoleMessage(CefRefPtr<CefBrowser> browser, const CefString& message, const CefString& source, int line)
bool ClientAdapter::OnConsoleMessage(CefRefPtr<CefBrowser> 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())
{
Expand Down
2 changes: 1 addition & 1 deletion CefSharp.Core/Internals/ClientAdapter.h
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,7 @@ namespace CefSharp
virtual DECL void OnFaviconURLChange(CefRefPtr<CefBrowser> browser, const std::vector<CefString>& iconUrls) OVERRIDE;
virtual DECL void OnFullscreenModeChange(CefRefPtr<CefBrowser> browser, bool fullscreen) OVERRIDE;
virtual DECL bool OnTooltip(CefRefPtr<CefBrowser> browser, CefString& text) OVERRIDE;
virtual DECL bool OnConsoleMessage(CefRefPtr<CefBrowser> browser, const CefString& message, const CefString& source, int line) OVERRIDE;
virtual DECL bool OnConsoleMessage(CefRefPtr<CefBrowser> browser, cef_log_severity_t level, const CefString& message, const CefString& source, int line) OVERRIDE;
virtual DECL void OnStatusMessage(CefRefPtr<CefBrowser> browser, const CefString& message) OVERRIDE;

// CefContextMenuHandler
Expand Down
9 changes: 8 additions & 1 deletion CefSharp/Event/ConsoleMessageEventArgs.cs
Original file line number Diff line number Diff line change
Expand Up @@ -14,16 +14,23 @@ public class ConsoleMessageEventArgs : EventArgs
/// <summary>
/// Creates a new ConsoleMessageEventArgs event argument.
/// </summary>
/// <param name="level">level</param>
/// <param name="message">message</param>
/// <param name="source">source</param>
/// <param name="line">line number</param>
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;
}

/// <summary>
/// Log level
/// </summary>
public LogSeverity Level { get; private set; }

/// <summary>
/// The message text of the console message.
/// </summary>
Expand Down

0 comments on commit 38be769

Please sign in to comment.