JonyEpsilon / gorilla-repl

A rich REPL for Clojure in the notebook style.
http://gorilla-repl.org
MIT License
887 stars 104 forks source link

Debugging side-channel #129

Closed mmower closed 10 years ago

mmower commented 10 years ago

I'm not sure how you'd implement this but it could be really cool if Gorilla offered a side-channel for debugging output that would be displayed, perhaps, alongside the output of a clojure section.

One possibility might be to redefine out and capture that and display it in a box to the right of the code output. At the moment stuff printed with, e.g., println seems to go nowhere which is unfortunate.

When I'm driving a function I'm testing from the repl it would be nice to be able to easily get some output from it when things aren't going as expected.

mmower commented 10 years ago

Having had a look at how it works I guess this might be quite difficult as the evaluation is all going on inside nrepl. I've had a look at that too but don't immediately understand whether an nrepl middleware could achieve this (and pass back output from the side channel to the front-end as part of the nrepl response).

mmower commented 10 years ago

Hrmm... so now I see that Gorilla is actually doing exactly this; I tried testing printing to stdout and saw the box... works everywhere. I guess I mustn't have seen the boxes before because I wasn't expecting them to be there. I'll close this and hope nobody spots how stupid/inobservant I am :)

JonyEpsilon commented 10 years ago

Yes. One tricky thing, that might have caught you out, is some code (I think) binds out to stdout such that output doesn't make it to Gorilla, but instead comes out on the console. That can be confusing!

jamesnyika commented 9 years ago

Hi JonyEpsilon Thanks so much for Gorilla... I wanted to follow up on the comment you made above. I have this precise issue - and I normally see this where I am using libraries like VitalLabs/probe which uses core.async channels when writing out to the console. I never see the output on my Gorilla Web Output. I thought when binding to stdout, it is ALL going to stdout ? what does some but not all the output make it to Gorilla ? Any ideas on what I could change to ? ..perhaps a different logging framework ?

JonyEpsilon commented 9 years ago

Yeah, I'm not really sure what exactly goes on here. Somewhere in the bowels of clojure there's something odd that goes on with binding to stdout. Gorilla never gets to see the output because nREPL never sends it out, but instead it goes directly to the console. Sorry I haven't got a more helpful answer!