define log_format just once and rename to log_timestamp_format
This commit is contained in:
parent
09ad45e9a6
commit
a1f25648a2
|
@ -56,7 +56,7 @@ author = 'Thor77'
|
||||||
# The short X.Y version.
|
# The short X.Y version.
|
||||||
version = '0.5'
|
version = '0.5'
|
||||||
# The full version, including alpha/beta/rc tags.
|
# The full version, including alpha/beta/rc tags.
|
||||||
release = '0.5.1'
|
release = '0.5.2'
|
||||||
|
|
||||||
# The language for content autogenerated by Sphinx. Refer to documentation
|
# The language for content autogenerated by Sphinx. Refer to documentation
|
||||||
# for a list of supported languages.
|
# for a list of supported languages.
|
||||||
|
|
2
setup.py
2
setup.py
|
@ -2,7 +2,7 @@ from setuptools import setup
|
||||||
|
|
||||||
setup(
|
setup(
|
||||||
name='tsstats',
|
name='tsstats',
|
||||||
version='0.5.1',
|
version='0.5.2',
|
||||||
author='Thor77',
|
author='Thor77',
|
||||||
author_email='thor77@thor77.org',
|
author_email='thor77@thor77.org',
|
||||||
description='A simple Teamspeak stats-generator',
|
description='A simple Teamspeak stats-generator',
|
||||||
|
|
|
@ -13,6 +13,8 @@ re_disconnect_invoker = re.compile(
|
||||||
r'invokername=(.*)\ invokeruid=(.*)\ reasonmsg'
|
r'invokername=(.*)\ invokeruid=(.*)\ reasonmsg'
|
||||||
)
|
)
|
||||||
|
|
||||||
|
log_timestamp_format = '%Y-%m-%d %H:%M:%S.%f'
|
||||||
|
|
||||||
|
|
||||||
logger = logging.getLogger('tsstats')
|
logger = logging.getLogger('tsstats')
|
||||||
|
|
||||||
|
@ -36,8 +38,8 @@ def parse_log(log_path, ident_map=None, clients=None):
|
||||||
logger.debug('No match: "%s"', line)
|
logger.debug('No match: "%s"', line)
|
||||||
continue
|
continue
|
||||||
match = match.groupdict()
|
match = match.groupdict()
|
||||||
log_format = '%Y-%m-%d %H:%M:%S.%f'
|
stripped_time = datetime.strptime(match['timestamp'],
|
||||||
stripped_time = datetime.strptime(match['timestamp'], log_format)
|
log_timestamp_format)
|
||||||
logdatetime = int((stripped_time - datetime(1970, 1, 1))
|
logdatetime = int((stripped_time - datetime(1970, 1, 1))
|
||||||
.total_seconds())
|
.total_seconds())
|
||||||
message = match['message']
|
message = match['message']
|
||||||
|
|
Loading…
Reference in New Issue