aboutsummaryrefslogtreecommitdiff
path: root/rpki/log.py
diff options
context:
space:
mode:
authorRob Austein <sra@hactrn.net>2015-11-11 03:22:38 +0000
committerRob Austein <sra@hactrn.net>2015-11-11 03:22:38 +0000
commit9f6d6462a9cef37735a9d4c61921d04934fd9864 (patch)
treee5d1b046f6f6bd44faf1b5028f6f1df9698e2a88 /rpki/log.py
parentac415cdd0f88f8479975627772dd0a84797b261a (diff)
Configure pylint to use the pylint-django plugin, which (mostly)
understands Django's exotic metaclasses, which in turn allows us to re-enable a number of pylint checks we had disabled. While we were at this, stripped out a bunch of old pylint pragmas, then added back the subset that were really needed. As usual with pylint, this turned up a few real bugs along with an awful lot of noise. svn path=/branches/tk705/; revision=6162
Diffstat (limited to 'rpki/log.py')
-rw-r--r--rpki/log.py18
1 files changed, 7 insertions, 11 deletions
diff --git a/rpki/log.py b/rpki/log.py
index 8afee4ba..dd3923a7 100644
--- a/rpki/log.py
+++ b/rpki/log.py
@@ -96,12 +96,12 @@ class Formatter(object):
try:
if not self.is_syslog:
yield time.strftime("%Y-%m-%d %H:%M:%S ", time.gmtime(record.created))
- except: # pylint: disable=W0702
+ except:
yield "[$!$Time format failed]"
try:
yield "%s[%d]: " % (self.ident, record.process)
- except: # pylint: disable=W0702
+ except:
yield "[$!$ident format failed]"
try:
@@ -111,12 +111,12 @@ class Formatter(object):
yield repr(record.context) + " "
except AttributeError:
pass
- except: # pylint: disable=W0702
+ except:
yield "[$!$context format failed]"
try:
yield record.getMessage()
- except: # pylint: disable=W0702
+ except:
yield "[$!$record.getMessage() failed]"
try:
@@ -129,7 +129,7 @@ class Formatter(object):
lines.insert(0, "\n")
for line in lines:
yield line
- except: # pylint: disable=W0702
+ except:
yield "[$!$exception formatting failed]"
@@ -218,8 +218,6 @@ def init(ident = None, args = None):
Default logging destination is stderr if "args" is not specified.
"""
- # pylint: disable=E1103
-
if ident is None:
ident = os.path.basename(sys.argv[0])
@@ -227,12 +225,12 @@ def init(ident = None, args = None):
args = argparse.Namespace(log_level = logging.WARNING,
log_handler = logging.StreamHandler)
- handler = args.log_handler()
+ handler = args.log_handler() # pylint: disable=E1101
handler.setFormatter(Formatter(ident, handler))
root_logger = logging.getLogger()
root_logger.addHandler(handler)
- root_logger.setLevel(args.log_level)
+ root_logger.setLevel(args.log_level) # pylint: disable=E1101
if ident and have_setproctitle and use_setproctitle:
if proctitle_extra:
@@ -262,8 +260,6 @@ def log_repr(obj, *tokens):
IDs as needed, includes tenant_handle when available.
"""
- # pylint: disable=W0702
-
words = ["%s.%s" % (obj.__class__.__module__, obj.__class__.__name__)]
try:
words.append("{%s}" % obj.tenant.tenant_handle)