utils.py

Sun, 21 Jan 2018 22:38:01 +0000

author
Tuomo Valkonen <tuomov@iki.fi>
date
Sun, 21 Jan 2018 22:38:01 +0000
changeset 42
00accd11978b
parent 40
cfbeeec8cb82
permissions
-rw-r--r--

Moved logwindow dispay out of BorgendTray, and made notification_center
display it (if it would work)

40
cfbeeec8cb82 Improved exception reporting etc.
Tuomo Valkonen <tuomov@iki.fi>
parents:
diff changeset
1 #
cfbeeec8cb82 Improved exception reporting etc.
Tuomo Valkonen <tuomov@iki.fi>
parents:
diff changeset
2 # Utility functions for Borgend
cfbeeec8cb82 Improved exception reporting etc.
Tuomo Valkonen <tuomov@iki.fi>
parents:
diff changeset
3 #
cfbeeec8cb82 Improved exception reporting etc.
Tuomo Valkonen <tuomov@iki.fi>
parents:
diff changeset
4
cfbeeec8cb82 Improved exception reporting etc.
Tuomo Valkonen <tuomov@iki.fi>
parents:
diff changeset
5 def log_exception(logger, err, detail=None):
cfbeeec8cb82 Improved exception reporting etc.
Tuomo Valkonen <tuomov@iki.fi>
parents:
diff changeset
6 err_type=err.__class__.__name__
cfbeeec8cb82 Improved exception reporting etc.
Tuomo Valkonen <tuomov@iki.fi>
parents:
diff changeset
7 if detail:
cfbeeec8cb82 Improved exception reporting etc.
Tuomo Valkonen <tuomov@iki.fi>
parents:
diff changeset
8 logger.critical('%s:%s "%s"', str(detail), err_type, str(err))
cfbeeec8cb82 Improved exception reporting etc.
Tuomo Valkonen <tuomov@iki.fi>
parents:
diff changeset
9 else:
cfbeeec8cb82 Improved exception reporting etc.
Tuomo Valkonen <tuomov@iki.fi>
parents:
diff changeset
10 logger.critical('%s "%s"', err_type, str(err))

mercurial