pretty
pretty copied to clipboard
Stacktrace HTML formatting
Hi Howard,
Turns out I do have a question: any plans/possibility of adding format-exception support for formatting to HTML?
Use cases include Ring middleware to display well-formatted stacktraces to authorised users, stacktraces in email log reports, etc.
On superficial examination, it looks like this might be possible by tweaking the *fonts* design to use arbitrary formatting patterns instead of prefixes - something like:
(def ^:dynamic *fonts*
{:exception #(format "<strong>%s</strong>" %)
...})
Any thoughts?
Thanks, cheers!
Yes, this feature is part of https://github.com/AvisoNovate/twixt.
For those finding this later, the file is in https://github.com/AvisoNovate/twixt/blob/042c88bb59150b46051efc1b1df3407b73236d22/src/io/aviso/twixt/exceptions.clj.
I think boosting that code out of twixt (which, I'm afraid, is currently not in my scope to maintain) and move it to pretty, would be useful.
I agree, I took a look at Twixt’s dependency tree, and it was too much to take on for HTML formatted stacks.
I think a good solution would be able to produce a markup string OR a Hiccup-style data structure.
Also note that Twixt would put the outermost exception first (at the top of the page, so you don't have to scroll) whereas pretty puts the outermost exception last (on the console, so you don't have to scroll).
On Mon, Oct 2, 2017 at 11:49 AM, Daniel Compton [email protected] wrote:
I agree, I took a look at the dependency tree, and it was too much to take on for HTML formatted stacks.
— You are receiving this because you modified the open/close state. Reply to this email directly, view it on GitHub https://github.com/AvisoNovate/pretty/issues/15#issuecomment-333628792, or mute the thread https://github.com/notifications/unsubscribe-auth/AADNtP84Lwz4E3SqAvIi0Y8dKi_h0EsVks5soTBIgaJpZM4BRGAj .
-- Howard M. Lewis Ship
Senior Mobile Developer at Walmart Labs
Creator of Apache Tapestry
(971) 678-5210 http://howardlewisship.com @hlship
I think a better solution would be to expose some of the private functions inside io.aviso.exception so that all the data used by pretty when writing text output could be used for markup output instead, but not tied to any particular representation.
Closing this for house keeping after 4 years.