* [python] how best to support colorized output? (with example colorized backtrace)
@ 2009-03-26 22:35 Andrew Sutherland
2009-03-27 0:19 ` Tom Tromey
0 siblings, 1 reply; 3+ messages in thread
From: Andrew Sutherland @ 2009-03-26 22:35 UTC (permalink / raw)
To: archer
Not too long ago I hacked up the example python backtrace command to
provide colorized output.
blog post:
http://www.visophyte.org/blog/2009/03/04/gaudily-colorized-gdb-backtraces-woo/
repo:
http://hg.mozilla.org/users/bugmail_asutherland.org/pythongdb-gaudy/
Thiago dropped by and commented, suggesting I post about it here.
While my solution was never intended to make it upstream (and should
not), I'd be interesting in finding out how colorized output could be
implemented that could be integrated.
Thiago mentioned that Tom had some ideas on this subject, and I'd be
particularly interested in hearing them.
Thanks,
Andrew
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [python] how best to support colorized output? (with example colorized backtrace)
2009-03-26 22:35 [python] how best to support colorized output? (with example colorized backtrace) Andrew Sutherland
@ 2009-03-27 0:19 ` Tom Tromey
2009-03-27 0:44 ` Andrew Sutherland
0 siblings, 1 reply; 3+ messages in thread
From: Tom Tromey @ 2009-03-27 0:19 UTC (permalink / raw)
To: Andrew Sutherland; +Cc: archer
>>>>> "Andrew" == Andrew Sutherland <sombrero@alum.mit.edu> writes:
Andrew> http://www.visophyte.org/blog/2009/03/04/gaudily-colorized-gdb-backtraces-woo/
Cool!
Andrew> Thiago dropped by and commented, suggesting I post about it here.
Nice outreach, thanks Thiago.
Andrew> While my solution was never intended to make it upstream (and should
Andrew> not), I'd be interesting in finding out how colorized output could be
Andrew> implemented that could be integrated.
I think the only thing I would suggest would be to use the existing
filtering backtrace, and just reimplement colorization as a filter.
If that's not possible (I didn't dig into the details too much), let's
modify the existing Python backtrace command to make it possible :-)
Tom
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [python] how best to support colorized output? (with example colorized backtrace)
2009-03-27 0:19 ` Tom Tromey
@ 2009-03-27 0:44 ` Andrew Sutherland
0 siblings, 0 replies; 3+ messages in thread
From: Andrew Sutherland @ 2009-03-27 0:44 UTC (permalink / raw)
To: archer
On 03/26/2009 05:18 PM, Tom Tromey wrote:
> I think the only thing I would suggest would be to use the existing
> filtering backtrace, and just reimplement colorization as a filter.
> If that's not possible (I didn't dig into the details too much), let's
> modify the existing Python backtrace command to make it possible :-)
Both the FilteringBacktrace class and its helper FrameWrapper class
directly write to an output stream as text devoid of any semantic
information. (They are using sys.stdout, though not always explicitly.)
It is hard to decorate this output without operating at the level of a
glorified colorizing regex.
I think something more along the line of a semantic stream (along the
lines of ui-out.h but perhaps more extensible) might work out, but could
be argued to be overkill.
For example, if the FrameWrapper did:
stream.write_string(FILENAME, sal.symtab.filename)
stream.write_text(":")
stream.write_int(LINENUMBER, sal.line)
that would be wildly easier to colorize. The default stream would just
ignore the semantic info and dump things as strings. The colorizing
stream would have colors bound to certain types of things. I am
obviously glossing over where FILENAME AND LINENUMBER would come from.
Crossing into definite exciting overkill territory would be pushing the
invocations of the pretty printers into the smart stream itself. That
way the stream could perhaps do something even more clever than the
default pretty printer. And if the stream was part of a GUI it might be
able to establish some actionable linkage so you can right-click and
have relevant actions, etc.
Andrew
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2009-03-27 0:44 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-03-26 22:35 [python] how best to support colorized output? (with example colorized backtrace) Andrew Sutherland
2009-03-27 0:19 ` Tom Tromey
2009-03-27 0:44 ` Andrew Sutherland
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).