From 2c9486fc2d188ef99acae8219f37c901eb078c92 Mon Sep 17 00:00:00 2001 From: Manuel Cortez Date: Sun, 1 Apr 2018 04:44:12 -0500 Subject: [PATCH] Added exceptohok module --- src/main.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/main.py b/src/main.py index 1740da3..1e02f3c 100644 --- a/src/main.py +++ b/src/main.py @@ -7,6 +7,10 @@ import traceback import sys storage.setup() logging.basicConfig(filename=os.path.join(storage.data_directory, "info.log"), level=logging.DEBUG, filemode="w") +# Let's mute the google discovery_cache logger as we won't use it and we'll avoid some tracebacks. +glog = logging.getLogger("googleapiclient.discovery_cache") +glog.setLevel(logging.CRITICAL) +# Let's capture all exceptions raised in our log file (especially useful for pyinstaller builds). sys.excepthook = lambda x, y, z: logging.critical(''.join(traceback.format_exception(x, y, z))) log = logging.getLogger("main") log.debug("Logger initialized. Saving debug to {0}".format(storage.data_directory,))