Hey Guys,
I was watching that old thread about the python logging module be
resurrected, and I wanted to point out something that I found which is
awesome! If you are feeling adventurous, you should have a look at this
thing called: Sentry
(https://pypi.python.org/pypi/sentry)<https://pypi.python.org/pypi/sentry>
.

*What is it?*
Sentry is just a messaging service. It's meant to aggregate a large number
of messages produced by code and show them in a simple feed.

*Why does it matter?*
It is a really smart solution to a question I had never really asked; "How
do I capture bugs *before *users report them?" There is even a paid
service<https://getsentry.com/pricing/>,
but luckily the underlying code is all open source. It's a pretty simple
Django service that's supported by Postgres. I've got a background in
web-dev so I was comfortable getting the service standing on a VM provided
by my system operations team. The docs are pretty good, so I'm sure you all
can get running without much effort.


*How does it work?*

As I mentioned Sentry itself is just a message service. You just need to
send it good data. The same paid service also release their client Raven
(https://github.com/getsentry/raven-python)<https://github.com/getsentry/raven-python>.
It has a built in exception capture system that will step through the
exception and dump the locals() per frame (Really awesome for debugging!)
AND it's threaded, so it should not interfere with the user interface.


I already had a logger in all my studio code and I was already using an
exception hook to capture out uncaught exceptions in a log file. The Sentry
system is decidedly better.


Here's a bare-bones example of how you might implement exception tracking:


import sys

try:

    import raven

    RAVEN_CLIENT = raven.Client('http://<key>@<server>:9000/<projectId>')

except:

    RAVEN_CLIENT = None


def exceptionHandler(excType, excValue, traceback):

    if RAVEN_CLIENT!=None:

        RAVEN_CLIENT.captureException(exc_info=(excType, excValue,
traceback))


sys.excepthook = exceptionHandler



*But this is a lot of data! *Don't worry, Sentry will handle data
expiration in a sane way. Repeat messages are dumped. I've only chewed up a
few hundred megs for my studio with roughly 200 users creating tracebacks.

You can even start reporting other messages or mix in some tagging to track
your projects. The tool has a rich set of features that I'm still learning.

So have a look. I hope it makes life better for someone out there.

Cheers,
Jesse

-- 
You received this message because you are subscribed to the Google Groups 
"Python Programming for Autodesk Maya" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/python_inside_maya/CANESWi2ny_yAG3%2BaoEOh00jv-K7q6ANjPst%3DXwnR%3DSXeN9RVCw%40mail.gmail.com.
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to