Skip to content

Get the console shim to actually do something useful #86

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
PeteDuncanson opened this issue Feb 18, 2015 · 3 comments
Closed

Get the console shim to actually do something useful #86

PeteDuncanson opened this issue Feb 18, 2015 · 3 comments
Assignees
Milestone

Comments

@PeteDuncanson
Copy link

We've found on a few occasions points where a little console statement would have made debugging so much easier.

Currently for server-side rendering a shim is included for console. I'm pondering two possible solutions that could be handy here. One is to allow the console statement to write to log4net or similar the other is to have the console statement append to an array and then if in debug mod (flagged somehow TBC) it spits the results out in page in a div at the end or as a client-side call to console.log( myinternallogger ); which would allow us to see the output in the browsers dev tools.

Thoughts?

@jslatts
Copy link
Contributor

jslatts commented Feb 18, 2015

Serious +1 on this! I have a somewhat decent workflow going, but every once in awhile, I run into an issue where the server-side rendering blows up and I am forced to pour over my code to try and figure out what is wrong. I was actually going to post an issue here to ask if I was doing it wrong.

I would be ok with either method, but I think having it spit the log messages out into a div would be easiest for most people to utilize.

@Daniel15 Daniel15 self-assigned this Feb 18, 2015
@Daniel15
Copy link
Member

The issue with calling back into .NET code is that there's no cross-engine way of doing it. ClearScript and VroomJs have different ways of doing it, but I don't think the MSIE engine supports it. I wonder if it could be added to JavaScriptEngineSwitcher. Alternatively I could just move to only supporting V8.

I love the idea of converting them to client-side console calls though! That should definitely be doable. The shim could cache all the calls and then just render them out when scripts are rendered. I'll work on this for the next release.

@Daniel15
Copy link
Member

Implemented a basic version in eff1c2b. This will catch all the console calls made server-side and output them as part of the JS init code (@Html.ReactInitJavaScript() in ASP.NET MVC). I can add a separate method that gets just the log calls if there's a valid use case for that :)

@Daniel15 Daniel15 added this to the 1.4 milestone Mar 1, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants