ulule/python-logstash-formatter

Exception is formatted as a list of strings

Closed this issue · 2 comments

When formatting exceptions/stacktraces, they are added to the message as a list of strings. Would it make sense to join the lines so that the exception-field is a full formatted stacktrace?

You know, as we are going to put this to logstash (so, probably, we've got distributed logs case here), it can be hard to reproduce an issue. Sometimes, you don't even have an access to the production server.

so, I'd rather vote for a more extendable way of handling exceptions.
I mean, at the moment is a plain https://github.com/exoscale/python-logstash-formatter/blob/master/logstash_formatter/__init__.py#L91 format_exception.
But there's https://pypi.python.org/pypi/tblib, or Flask (or Werkzeug, I'm not really in context there) also serializes a traceback somehow to put it on html debug page.

So, I'd suggest to move traceback formatting function to the class atrribute so that it's easy for anyone to override it. like this:

class MyFancyTracebackFormatter(LogstashFormatter):
    tb_formatter = my_fancy_formatter

I hope to add a pullrequest soon.

pyr commented

This is beyond the scope of this project at the moment. But may chance with new maintainers.