sketchup-ruby-debugger icon indicating copy to clipboard operation
sketchup-ruby-debugger copied to clipboard

Sending STDOUT and STDERR output to external debugger console ...

Open DanRathbun opened this issue 7 years ago • 5 comments

How to send STDOUT and STDERR output to external debugger console instead of SketchUp's internal Ruby Console ?

puts() seems not to work.

On Windows I tried OutputDebugString and it sends to MS DebugView, but I see nothing in VSCODE's console.

Is there a "mixed" or "managed" mode setting somewhere for VSCODE ?

DanRathbun avatar Sep 22 '18 20:09 DanRathbun

This would be nice. But I don't believe the ruby-debug-ide protocol supports a way to send such output to the debugger client. I might be wrong though.

BugraBarin avatar Sep 27 '18 00:09 BugraBarin

Backstory: I'm weary of SketchUp's internal Ruby Console being broken every few releases. I'd like to send console output to something external and leave SketchUp's console closed.

DanRathbun avatar Sep 27 '18 16:09 DanRathbun

I actually started on something like this a couple of weeks ago. It doesn't redirect STDOUT/STDERR, but a logger utility that would by default output to $stdout, but with an option to connect to an output server via sockets.

traceup

thomthom avatar Oct 04 '18 15:10 thomthom

Have you ever tried Ruby's Logger utility ? http://ruby-doc.org/stdlib-2.2.4/libdoc/logger/rdoc/index.html

It has a lot of built-in nifty housekeeping stuff. I was thinking of using it and perhaps subclassing it for use in embedded SketchUp.

Although, I'd set up a mixin protocol where the various methods (warn, info, debug, etc., ...) could be used without qualification, and the extension itself instantiates the logger instance object when it loads (if logging is enabled.)

If endusers had issues, the logs could be sent to a server similar to how reports are sent to Windows Error Reporting or BugSplat.

DanRathbun avatar Oct 04 '18 20:10 DanRathbun

Yea, I've had a look at that in some projects. Useful when you want to log to a file. (So user can send you it if SU crashes etc, or keep useful info to help repro issues.) The tool I showed earlier in this thread was a little bit different in purpose, more of a way to keep track of the current value of a given variable.

thomthom avatar Oct 04 '18 20:10 thomthom