Welcome Guest Search | Active Topics | Sign In | Register

Incorrect Severity for ConsoleApi events? Options
Christian Porzio
Posted: Tuesday, August 27, 2019 4:32:37 PM
Rank: Advanced Member
Groups: Member

Joined: 10/4/2016
Posts: 104
Hi,

Using version: 19.2.11.0

I seem to get incorrect Severity values for the console logs.

Please advise.

Code: C#
private void WebView_ConsoleMessage(object sender, ConsoleMessageEventArgs e)


Respective values:
Code: JavaScript
console.debug('a debug message');
Severity Error EO.WebBrowser.ConsoleMessageSeverity
Type ConsoleAPI EO.WebBrowser.ConsoleMessageType

Code: JavaScript
console.log('a log message');
Severity Debug EO.WebBrowser.ConsoleMessageSeverity
Type ConsoleAPI EO.WebBrowser.ConsoleMessageType

Code: JavaScript
console.info('an info message');

Severity Debug EO.WebBrowser.ConsoleMessageSeverity
Type ConsoleAPI EO.WebBrowser.ConsoleMessageType

Code: JavaScript
console.warn('a warning message');

Severity Warning EO.WebBrowser.ConsoleMessageSeverity
Type ConsoleAPI EO.WebBrowser.ConsoleMessageType

Code: JavaScript
console.error('an error message');

Severity Error EO.WebBrowser.ConsoleMessageSeverity
Type ConsoleAPI EO.WebBrowser.ConsoleMessageType

I would have expected EO.WebBrowser.ConsoleMessageSeverity to match the actual levels used (Debug, Log, Warning and Error) - though missing Info also.

Please note this is affecting quite significantly our support because any application posting debug messages will be interpreted as errors and may trigger unjustified alerts in our framework.

Code: C#
private void WebView_ConsoleMessage(object sender, ConsoleMessageEventArgs e)
        {
            string source = e.Source;
            if (source.Length < 3)
                source = "unknown_source";
            int p0 = source.IndexOf("//");
            if (p0 > 0)
            {
                source = source.Substring(p0 + 2);
                int p1 = source.IndexOf('/');
                if (p1 > 0)
                {
                    source = source.Substring(p1 + 1);
                }
            }
            string msg = new StringBuilder(e.Message).Append(" :").Append(" :").Append(source).Append(e.LineNumber.ToString()).ToString();
            try
            {
                switch (e.Severity)
                {
                    case ConsoleMessageSeverity.Debug:
                        // This will actually never be executed!
                        WebLog(WEB_EVENT.CONSOLE_LOG, msg, LogUtil.Level.DEBUG);
                        break;
                    case ConsoleMessageSeverity.Log:
                        WebLog(WEB_EVENT.CONSOLE_LOG, msg);
                        break;
                    case ConsoleMessageSeverity.Warning:
                        WebLog(MsgLogID.ID00079, WEB_EVENT.CONSOLE_LOG, msg, LogUtil.Level.WARNING);
                        break;
                    case ConsoleMessageSeverity.Error:
                        // This may trigger unjustified alerts for Debug messages!!
                        WebLog(MsgLogID.ID00080, WEB_EVENT.CONSOLE_LOG, msg, LogUtil.Level.ERROR);
                        break;
                    default:
                        WebLog(MsgLogID.ID00081, WEB_EVENT.CONSOLE_LOG, msg + " (unknown severity)", LogUtil.Level.WARNING);
                        break;
                }
                if (_viewConsole)
                {
                    AddMsg2ConsoleViewer(e.LineNumber, e.Severity.ToString(), e.Message);
                }
            } catch (Exception ex)
            {
                WebLog(MsgLogID.ID00073, WEB_EVENT.CONSOLE_LOG, "WebView_ConsoleMessage failed", ex, LogUtil.Level.ERROR);
            }
        }

eo_support
Posted: Wednesday, August 28, 2019 3:45:43 PM
Rank: Administration
Groups: Administration

Joined: 5/27/2007
Posts: 24,218
Hi,

We have confirmed this to be an issue. This will be fixed in our next build.

Thanks!
Christian Porzio
Posted: Wednesday, August 28, 2019 4:12:55 PM
Rank: Advanced Member
Groups: Member

Joined: 10/4/2016
Posts: 104
Hi,

Great news!

Will you provide a complete mapping of EO.WebBrowser.ConsoleMessageSeverity with the current API: debug, log, info, warn and error?

Regards
eo_support
Posted: Wednesday, August 28, 2019 4:37:50 PM
Rank: Administration
Groups: Administration

Joined: 5/27/2007
Posts: 24,218
It will be exactly like what you have explained. For example, console.debug -> Debug, console.log -> Log, console.warn to Warning console.Error to Error.
Christian Porzio
Posted: Wednesday, September 4, 2019 10:12:38 PM
Rank: Advanced Member
Groups: Member

Joined: 10/4/2016
Posts: 104
Hi, any ETA on the fix release? I just need to know to plan accordingly our next release.

Thank you!
eo_support
Posted: Thursday, September 5, 2019 10:04:57 AM
Rank: Administration
Groups: Administration

Joined: 5/27/2007
Posts: 24,218
Our next update is planed around mid September. So it's about one to two weeks out.
eo_support
Posted: Tuesday, September 17, 2019 9:57:33 AM
Rank: Administration
Groups: Administration

Joined: 5/27/2007
Posts: 24,218
Hi,

This is just to let you know that we have posted a new build that should fix this issue. You can download the new build from our download page. Please take a look and let us know how it goes.

Thanks
Christian Porzio
Posted: Monday, September 23, 2019 6:15:22 PM
Rank: Advanced Member
Groups: Member

Joined: 10/4/2016
Posts: 104
Hi,

Thank you. This is much better:

Code: JavaScript
// ConsoleMessageSeverity.Debug
console.debug("DEBUG");

// ConsoleMessageSeverity.Log
console.trace("TRACE");
console.log("LOG");
console.info("INFO");

// ConsoleMessageSeverity.Warning
console.warn("WARNING");

// ConsoleMessageSeverity.Error
console.error("ERROR");


Just by curiosity... Any reason why ConsoleMessageSeverity.Trace and Info do not exist?

Thanks again for taking care of this!
eo_support
Posted: Tuesday, September 24, 2019 9:40:07 AM
Rank: Administration
Groups: Administration

Joined: 5/27/2007
Posts: 24,218
Hi,

This is because these values only exists in the JavaScript engine. While there are many different levels defined in JavaScript engine, the core browser engine only has 4 levels as defined in this file:

https://cs.chromium.org/chromium/src/third_party/blink/public/mojom/devtools/console_message.mojom?sq=package:chromium&g=0&l=7

So as the message level is passed back from the JavaScript engine into the browser engine, it must map to one of these 4 values.

Thanks!


You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.