Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add ability to pass a directory for --log option #17

Merged
merged 1 commit into from
Mar 8, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion docs/source/quickstart.rst
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,8 @@ To start, you can just use cli-arguments to control the behaviour of TeamspeakSt
-c CONFIG, --config CONFIG
path to config
--idmap IDMAP path to id_map
-l LOG, --log LOG path to your logfile(s)
-l LOG, --log LOG path to your logfile(s). pass a directory to use all
logfiles inside it
-o OUTPUT, --output OUTPUT
path to the output-file
-d, --debug debug mode
Expand Down
6 changes: 4 additions & 2 deletions tsstats/__main__.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
import argparse
import json
import logging
from os.path import abspath, exists
from os.path import abspath, exists, isdir, join as pathjoin

from tsstats import config
from tsstats.exceptions import InvalidConfiguration
Expand All @@ -30,7 +30,7 @@ def cli():
)
parser.add_argument(
'-l', '--log',
type=str, help='path to your logfile(s)'
type=str, help='path to your logfile(s). pass a directory to use all logfiles inside it'
)
parser.add_argument(
'-o', '--output',
Expand Down Expand Up @@ -98,6 +98,8 @@ def main(configuration):
log = configuration.get('General', 'log')
if not log:
raise InvalidConfiguration('log or output missing')
if isdir(log):
log = pathjoin(log, '*.log')

servers = parse_logs(
log, ident_map=identmap,
Expand Down