ENH: Rename fail2ban_excepthook to excepthook

pull/701/head
Steven Hiscocks 2014-06-10 20:38:18 +01:00
parent 4fc7f1a831
commit 9764c78415
3 changed files with 5 additions and 5 deletions

View File

@ -113,7 +113,7 @@ def getLogger(name):
"""
return logging.getLogger("fail2ban.%s" % name.rpartition(".")[-1])
def fail2ban_excepthook(exctype, value, traceback):
def excepthook(exctype, value, traceback):
"""Except hook used to log unhandled exceptions to Fail2Ban log
"""
getLogger("fail2ban").critical(

View File

@ -28,7 +28,7 @@ import sys
from threading import Thread
from abc import abstractproperty, abstractmethod
from ..helpers import fail2ban_excepthook
from ..helpers import excepthook
class JailThread(Thread):
"""Abstract class for threading elements in Fail2Ban.
@ -63,7 +63,7 @@ class JailThread(Thread):
try:
run(*args, **kwargs)
except:
fail2ban_excepthook(*sys.exc_info())
excepthook(*sys.exc_info())
self.run = run_with_except_hook
@abstractproperty

View File

@ -32,7 +32,7 @@ from .filter import FileFilter, JournalFilter
from .transmitter import Transmitter
from .asyncserver import AsyncServer, AsyncServerException
from .. import version
from ..helpers import getLogger, fail2ban_excepthook
from ..helpers import getLogger, excepthook
# Gets the instance of the logger.
logSys = getLogger(__name__)
@ -71,7 +71,7 @@ class Server:
signal.signal(signal.SIGINT, self.__sigTERMhandler)
# Ensure unhandled exceptions are logged
sys.excepthook = fail2ban_excepthook
sys.excepthook = excepthook
# First set the mask to only allow access to owner
os.umask(0077)