Sun, 21 Jan 2018 21:32:48 +0000
Improved exception reporting etc.
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)) |