Phil,
Indeed, clj-backtrace was largely inspired by Rubinius' "Awsome
Backtrace" feature.
I've implemented and pushed to GitHub an experimental implementation
of colorized backtraces for the REPL:
In addition to the usual (pst) to pretty-print the last exception, you
can now (pst+) to colorized-pretty-print it.
The current color scheme:
(defn elem-color
"Returns a symbol identifying the color appropriate for the given trace elem.
:green All Java elems
:magenta Any fn in the user or repl* namespaces (i.e. entered at REPL)
:blue Any fn in clojure.* (e.g. clojure.core, clojure.contrib.*)
:default Anything else - i.e. Clojure libraries and app code."
[elem]
(cond
(:java elem)
:green
(or (nil? (:ns elem)) (re-match? #"^(user|repl)" (:ns elem)))
:magenta
(re-match? #"^clojure\." (:ns elem))
:blue
:else
:default))
On Thu, Jan 8, 2009 at 7:17 PM, Phil Hagelberg <[email protected]> wrote:
>
> Mark McGranaghan <[email protected]> writes:
>
>> I'd also be happy to answer any questions you have about using the
>> library and to hear any general comments.
>
> This looks great! I love the way they're aligned.
>
> Have you looked at the way Rubinius (a smalltalk-style Ruby VM) prints
> backtraces? It's pretty similar, although it goes one step further by
> coloring different portions of the backtraces differently depending on
> where they came from. See the example in the middle of this article:
>
> http://programblings.com/2008/04/15/rubinius-for-the-layman-part-2-how-rubinius-is-friendly/
>
> I would love to see clojure.core code in one color, java-level code in
> another, "unknown source" (repl-entered) code in another, and my
> application's code in white.
>
> I'll definitely be using this; thanks.
>
> -Phil
>
> >
>
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Clojure" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
-~----------~----~----~----~------~----~------~--~---