use % formatting in logging-functions

This commit is contained in:
Thor77 2016-05-11 20:45:42 +02:00
parent c25db473ec
commit e7fc91229e
2 changed files with 6 additions and 6 deletions

View File

@ -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

View File

@ -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