summaryrefslogtreecommitdiff
path: root/fail2ban/__init__.py
diff options
context:
space:
mode:
authorsebres <serg.brester@sebres.de>2018-09-26 21:00:51 +0200
committersebres <serg.brester@sebres.de>2018-09-26 21:00:51 +0200
commit17da4943df0716b394e2b40a973357fa0b423183 (patch)
tree1a61d72679c63e47f4a46943a65cb09da8f6a7f3 /fail2ban/__init__.py
parent2a4c47ea32b2e483746c757896ff0d63a1403f6b (diff)
downloadfail2ban-17da4943df0716b394e2b40a973357fa0b423183.tar.gz
use short log-names for special pure numeric log-level (e.g. "Level 25" could be truncated by short formats)
Diffstat (limited to 'fail2ban/__init__.py')
-rw-r--r--fail2ban/__init__.py7
1 files changed, 7 insertions, 0 deletions
diff --git a/fail2ban/__init__.py b/fail2ban/__init__.py
index 317f53e7..fa6dcf77 100644
--- a/fail2ban/__init__.py
+++ b/fail2ban/__init__.py
@@ -79,3 +79,10 @@ logging.handlers.SysLogHandler.priority_map['NOTICE'] = 'notice'
from time import strptime
# strptime thread safety hack-around - http://bugs.python.org/issue7980
strptime("2012", "%Y")
+
+# short names for pure numeric log-level ("Level 25" could be truncated by short formats):
+def _init():
+ for i in xrange(50):
+ if logging.getLevelName(i).startswith('Level'):
+ logging.addLevelName(i, '#%02d-Lev.' % i)
+_init()