Created
June 9, 2014 14:15
-
-
Save alanbriolat/0ced3d4f9caad67a81a5 to your computer and use it in GitHub Desktop.
Log unhandled Python exceptions with logging.critical(...).
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 traceback | |
| import sys | |
| def excepthook(type, value, tb): | |
| for part in traceback.format_exception(type, value, tb): | |
| for line in part.splitlines(): | |
| logging.critical(line) | |
| sys.excepthook = excepthook |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment