summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/leap/app.py10
-rw-r--r--src/leap/util/leap_argparse.py4
2 files changed, 14 insertions, 0 deletions
diff --git a/src/leap/app.py b/src/leap/app.py
index 3864ffeb..1ab806ca 100644
--- a/src/leap/app.py
+++ b/src/leap/app.py
@@ -17,6 +17,7 @@ def main():
parser, opts = leap_argparse.init_leapc_args()
debug = getattr(opts, 'debug', False)
+ # XXX get severity from command line args
if debug:
level = logging.DEBUG
else:
@@ -31,6 +32,15 @@ def main():
'- %(name)s - %(levelname)s - %(message)s')
console.setFormatter(formatter)
logger.addHandler(console)
+
+ logfile = getattr(opts, 'log_file', False)
+ if logfile:
+ logger.debug('setting logfile ', logfile)
+ fileh = logging.FileHandler(logfile)
+ fileh.setLevel(logging.DEBUG)
+ fileh.setFormatter(formatter)
+ logger.addHandler(fileh)
+
logger.debug('args: %s' % opts)
logger.info('Starting app')
diff --git a/src/leap/util/leap_argparse.py b/src/leap/util/leap_argparse.py
index 9c355134..f329cf3e 100644
--- a/src/leap/util/leap_argparse.py
+++ b/src/leap/util/leap_argparse.py
@@ -11,6 +11,10 @@ Launches main LEAP Client""", epilog=epilog)
action="store", dest="config_file",
type=argparse.FileType('r'),
help='optional config file')
+ parser.add_argument('--logfile', metavar="LOG FILE", nargs='?',
+ action="store", dest="log_file",
+ #type=argparse.FileType('w'),
+ help='optional log file')
return parser