Logo
My Account |  Site Map | Contact Us  
Welcome Guest Search | Active Topics | Sign In | Register

Capturing console.trace() output Options
Christian Porzio
Posted: Wednesday, June 13, 2018 4:45:07 PM
Rank: Advanced Member
Groups: Member

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

Invoking this piece of code:
Code: JavaScript
function traceLog()
        {
            function foo() {
                function bar() {
                    window.console.trace();
                }
                bar();
            }
            foo();
        }


will produce this result in the Chromium Console inspect:
console.trace
bar @ UnitTest.html:321
foo @ UnitTest.html:323
traceLog @ UnitTest.html:325
onclick @ UnitTest.html:41


However the only thing we get in the
Code: C#
void WebView_ConsoleMessage(object sender, ConsoleMessageEventArgs e)
is:
console.trace

Is there a way to actually obtain the same kind of information?

Thank you!
eo_support
Posted: Friday, June 15, 2018 3:12:00 PM
Rank: Administration
Groups: Administration

Joined: 5/27/2007
Posts: 20,678
Hi,

We have looked into this issue. This function is not exactly a console output message ---- it's a debugger call and its implementation is closed tied to the built in debugger in the way of:

1. Debugger must be active in order to acquire the stack trace (since stack trace is acquired through the debugger interface);
2. When debugger is active, the output is sent to the debugger;

This means when debugger is not active, you will not get the stack trace (as you have observed), and when debugger is active, you won't get any output at all (because the output would be sent to the debugger). To verify this, you can start the built-in debugger interface by following these steps:

https://www.essentialobjects.com/doc/webbrowser/advanced/debug.aspx

Hope this helps. Please feel free to let us know if you still have any questions.

Thanks!
Christian Porzio
Posted: Monday, June 18, 2018 9:34:51 AM
Rank: Advanced Member
Groups: Member

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

Thank you for your response. We are interested in getting the full output when the debugger is not running.

We found this post that will allow our web developers to replace their direct calls to trace by something else that will produce true console outputs:

https://stackoverflow.com/questions/6715571/how-to-get-result-of-console-trace-as-string-in-javascript-with-chrome-or-fire

I don't think there is any other work around because the call has to be made from within the web UI, and if the web engine is not producing the expected outputs, I don't think there is anything your wrapper can do on top of that.

Regards
eo_support
Posted: Monday, June 18, 2018 10:05:51 AM
Rank: Administration
Groups: Administration

Joined: 5/27/2007
Posts: 20,678
Yes. You can do this in your own code. While its technical possible for us to include such code on our end, we would prefer not doing so since it would open the door of a host of other debug only features. Those features are designed to be accessed through debug console only and is not meant to be accessed through code, so we would keep them that way.


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.