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]) 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 """Except hook used to log unhandled exceptions to Fail2Ban log
""" """
getLogger("fail2ban").critical( getLogger("fail2ban").critical(

View File

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

View File

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