ENH: rudimentary __repr__ for Filter and Jail + moved usedns into set method

otherwise usedns is way too noisy, especially within fail2ban-regex
pull/38/head
Yaroslav Halchenko 2012-02-10 21:59:26 -05:00
parent 25f1e8d98c
commit 2245ff5b41
2 changed files with 8 additions and 2 deletions

View File

@ -73,9 +73,12 @@ class Filter(JailThread):
self.dateDetector = DateDetector()
self.dateDetector.addDefaultTemplate()
logSys.debug("Created Filter")
logSys.debug("Created %s" % self)
def __repr__(self):
return "%s(%r)" % (self.__class__.__name__, self.jail)
##
# Add a regular expression which matches the failure.
#
@ -146,6 +149,7 @@ class Filter(JailThread):
# @param value the usedns mode
def setUseDns(self, value):
logSys.debug("Setting usedns = %s for %s" % (value, self))
self.__useDns = value
##
@ -586,7 +590,6 @@ class DNSUtils:
if useDns == "no":
return None
else:
logSys.debug("usedns = %s" % useDns)
ipList = list()
# Search for plain IP
plainIP = DNSUtils.searchIP(text)

View File

@ -42,6 +42,9 @@ class Jail:
logSys.info("Creating new jail '%s'" % self.__name)
self._setBackend(backend)
def __repr__(self):
return "%s(%r)" % (self.__class__.__name__, self.__name)
def _setBackend(self, backend):
backend = backend.lower() # to assure consistent matching