Fix logging in non-debug mode
This commit is contained in:
parent
d569d9488a
commit
f9b62564ca
2 changed files with 7 additions and 3 deletions
|
@ -26,14 +26,18 @@ def formatException(err=None, format="text"):
|
|||
import traceback
|
||||
if type(err) == Notify:
|
||||
return err
|
||||
elif type(err) == tuple and err[0] is not None: # Passed trackeback info
|
||||
elif type(err) == tuple and err and err[0] is not None: # Passed trackeback info
|
||||
exc_type, exc_obj, exc_tb = err
|
||||
err = None
|
||||
else: # No trackeback info passed, get latest
|
||||
exc_type, exc_obj, exc_tb = sys.exc_info()
|
||||
|
||||
if not err:
|
||||
if hasattr(err, "message"):
|
||||
err = exc_obj.message
|
||||
else:
|
||||
err = exc_obj
|
||||
|
||||
tb = []
|
||||
for frame in traceback.extract_tb(exc_tb):
|
||||
path, line, function, text = frame
|
||||
|
|
|
@ -50,7 +50,7 @@ def handleErrorNotify(*args, **kwargs):
|
|||
if err.__name__ == "KeyboardInterrupt":
|
||||
shutdown("Keyboard interrupt")
|
||||
elif err.__name__ != "Notify":
|
||||
logging.error("Unhandled exception: %s" % [args])
|
||||
logging.error("Unhandled exception 3: %s" % Debug.formatException())
|
||||
sys.__excepthook__(*args, **kwargs)
|
||||
|
||||
|
||||
|
|
Loading…
Reference in a new issue