Mailing List Archive: 49091 messages
  • Home
  • Script library
  • AltME Archive
  • Mailing list
  • Articles Index
  • Site search

Capturing trace output

 [1/4] from: SunandaDH::aol::com at: 17-Oct-2004 12:40

In an attempt to make trace even slightly useful, I doodled this code: captured-print: copy [] ;; all print gets saved here system-print: get in system/words 'print ;; copy original print function system-prin: get in system/words 'prin ;; copy original prin function print: func [item] [ ;; redefine print insert captured-print item captured-print: copy/part captured-print 500 ] prin: :print ;; redefine prin (I know there are subtle differences between the way 'system-print and 'print work, but they are not relevant here). So, in theory, I could run a script that has a trace in it, and then check captured-print for the last 500 items. Rather than spending 10 times as long watching bazillions of lines whizz past on the console. Not so, though. Trace seems to output to the console without using 'print -- looks like one of those few immutable things about REBOL. Any suggestions? Thanks, Sunanda.

 [2/4] from: gabriele:colellachiara at: 17-Oct-2004 19:37

Hi SunandaDH, On Sunday, October 17, 2004, 6:40:46 PM, you wrote: Sac> Any suggestions? Change system/ports/output. You can create your own scheme handler which saves all output. (If you still want to see the output on the console, you can change system/ports/echo instead.) For an example you can check my broadcast-console.r script. Regards, Gabriele. -- Gabriele Santilli <[g--santilli--tiscalinet--it]> -- REBOL Programmer Amiga Group Italia sez. L'Aquila --- SOON:

 [3/4] from: atruter::labyrinth::net::au at: 18-Oct-2004 8:02

> Any suggestions?
echo %trace.txt Regards, Ashley

 [4/4] from: SunandaDH::aol::com at: 19-Oct-2004 5:09

> Change system/ports/output
Thanks for the suggestion. But I've rather belatedly realised the stupidity of trying to execute any code that intercepts 'trace -- it'l just get itself traced down a recursive rabbit hole. Ashley:
> echo %trace.txt
Thanks too for the suggestion. I was hoping for something more interactive -- so I could suppress or embellish the trace depending on other conditions. I guess it's back to the drawing board, Sunanda.