Created
July 7, 2020 09:06
-
-
Save marcbelmont/7fec11c17e368e16b255cb336ee54bba to your computer and use it in GitHub Desktop.
Use Rollbar with Tornado Web
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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