From 5f979e37a9c167e0d2186ca3d7551b471f5b0c2e Mon Sep 17 00:00:00 2001 From: Daniel Hiepler Date: Sun, 10 Apr 2016 03:01:22 +0200 Subject: [PATCH] re-added commit c005c31af that got rolled back --- transwhat.py | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/transwhat.py b/transwhat.py index 4f1fb91..8186a93 100644 --- a/transwhat.py +++ b/transwhat.py @@ -48,6 +48,7 @@ from yowsup.stacks import YowStack # Arguments parser = argparse.ArgumentParser() parser.add_argument('--debug', action='store_true') +parser.add_argument('--log', type=str) parser.add_argument('--host', type=str, required=True) parser.add_argument('--port', type=int, required=True) parser.add_argument('--service.backend_id', metavar="ID", type=int, required=True) @@ -57,12 +58,15 @@ parser.add_argument('-j', type=str, metavar="JID", required=True) args, unknown = parser.parse_known_args() YowConstants.PATH_STORAGE='/var/lib/spectrum2/' + args.j -loggingfile = '/var/log/spectrum2/' + args.j + '/backends/backend.log' + +if args.log is None: + args.log = '/var/log/spectrum2/' + args.j + '/backends/backend.log' + # Logging -logging.basicConfig( \ - filename=loggingfile,\ - format = "%(asctime)-15s %(levelname)s %(name)s: %(message)s", \ - level = logging.DEBUG if args.debug else logging.INFO \ +logging.basicConfig( + filename = args.log, + format = "%(asctime)-15s %(levelname)s %(name)s: %(message)s", + level = logging.DEBUG if args.debug else logging.INFO ) # Handler