From e7fc91229eb9ebe56aa95521b8a87fbc5024a8a9 Mon Sep 17 00:00:00 2001 From: Thor77 Date: Wed, 11 May 2016 20:45:42 +0200 Subject: [PATCH] use % formatting in logging-functions --- tsstats/client.py | 8 ++++---- tsstats/log.py | 4 ++-- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/tsstats/client.py b/tsstats/client.py index 6a43d30..12a8ca3 100644 --- a/tsstats/client.py +++ b/tsstats/client.py @@ -67,7 +67,7 @@ class Client: ''' client connects at "timestamp" ''' - logger.debug('CONNECT {}'.format(str(self))) + logger.debug('CONNECT %s', self) self.connected += 1 self._last_connect = timestamp @@ -75,7 +75,7 @@ class Client: ''' client disconnects at "timestamp" ''' - logger.debug('DISCONNECT {}'.format(str(self))) + logger.debug('DISCONNECT %s', self) if not self.connected: logger.debug('^ disconnect before connect') raise InvalidLog('disconnect before connect!') @@ -88,7 +88,7 @@ class Client: ''' client kicks "target" (Client-obj) ''' - logger.debug('KICK {} -> {}'.format(str(self), str(target))) + logger.debug('KICK %s -> %s', self, target) target.pkicks += 1 self.kicks += 1 @@ -96,7 +96,7 @@ class Client: ''' client bans "target" (Client-obj) ''' - logger.debug('BAN {} -> {}'.format(str(self), str(target))) + logger.debug('BAN %s -> %s', self, target) target.pbans += 1 self.bans += 1 diff --git a/tsstats/log.py b/tsstats/log.py index ff7f222..3a52d82 100644 --- a/tsstats/log.py +++ b/tsstats/log.py @@ -23,7 +23,7 @@ def parse_logs(log_path, ident_map={}): for file_path in file_paths: log_file = open(file_path) # process lines - logger.debug('Started parsing of {}'.format(log_file.name)) + logger.debug('Started parsing of %s', log_file.name) for line in log_file: parts = line.split('|') log_format = '%Y-%m-%d %H:%M:%S.%f' @@ -51,5 +51,5 @@ def parse_logs(log_path, ident_map={}): invoker.ban(client) else: invoker.kick(client) - logger.debug('Finished parsing of {}'.format(log_file.name)) + logger.debug('Finished parsing of %s', log_file.name) return clients