Skip to content

Instantly share code, notes, and snippets.

@marcbelmont
Created July 7, 2020 09:06
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save marcbelmont/7fec11c17e368e16b255cb336ee54bba to your computer and use it in GitHub Desktop.
Save marcbelmont/7fec11c17e368e16b255cb336ee54bba to your computer and use it in GitHub Desktop.
Use Rollbar with Tornado Web
import tornado.ioloop
import tornado.web
class MyRequestHandler(tornado.web.RequestHandler):
def log_exception(self, typ, value, tb):
rollbar.report_exc_info((typ, value, tb))
super().log_exception(typ, value, tb)
class MainHandler(MyRequestHandler):
def get(self):
self.write("Hello, world")
if __name__ == "__main__":
rollbar.init('xxx', handler='tornado')
application = tornado.web.Application([
(r"/", MainHandler),
])
application.listen(8888)
tornado.ioloop.IOLoop.current().start()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment