diff options
author | Anton Khirnov <anton@khirnov.net> | 2020-04-04 13:36:13 +0200 |
---|---|---|
committer | Anton Khirnov <anton@khirnov.net> | 2020-04-04 13:36:13 +0200 |
commit | 233815932553bdf9781e6bbde9976abfe458b93a (patch) | |
tree | 66dedfc9b636b519dff615d5a444d10f869fc96f /sshban.py | |
parent | 6ad84a587e6177b7c8af101b4806a1fc5f8c082b (diff) |
sshban: log uncaught top-level exception
Makes it more noticeable when sshban dies.
Diffstat (limited to 'sshban.py')
-rwxr-xr-x | sshban.py | 5 |
1 files changed, 5 insertions, 0 deletions
@@ -177,6 +177,11 @@ for h in handlers: h.setFormatter(formatter) logger.addHandler(h) +# log uncaught top-level exception +def excepthook(t, v, tb, logger = logger): + logger.error('Uncaught top-level exception', exc_info = (t, v, tb)) +sys.excepthook = excepthook + judge = Judge({ ACT_BAN_SHORT : args.thresh_short, ACT_BAN_MEDIUM : args.thresh_medium, ACT_BAN_LONG : args.thresh_long }) # open FIFO read-write so poll() won't return HUP endlessly if the writer dies |