added new option for log file
This commit is contained in:
parent
feb4e4ac88
commit
c005c31afa
14
transwhat.py
14
transwhat.py
|
@ -43,6 +43,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)
|
||||
|
@ -52,12 +53,15 @@ parser.add_argument('-j', type=str, 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
|
||||
|
|
Loading…
Reference in a new issue