Add an option to use a log file, this will made debugging easier

parent 3c9acec4
......@@ -178,6 +178,11 @@ def _get_parser():
dest="log",
default="info",
help="logging level: debug, info, warning, error, critical")
parser.add_argument(
"--logfile",
help="path to the optional log file",
default=None,
dest="logfile")
parser.add_argument(
"-p", "--prefix",
dest="prefix_code",
......
......@@ -42,7 +42,7 @@ def set_logging_level(options):
if not isinstance(numeric_level, int):
sys.exit('Invalid log level: %s' % options.log)
if not shell.check_windows():
if not shell.check_windows() and options.logfile == None:
logging.basicConfig(
format=colored(
"%(levelname)s",
......@@ -55,7 +55,8 @@ def set_logging_level(options):
format="%(levelname)s" +
"\t%(filename)s:%(lineno)d: %(funcName)s()\t" +
"%(message)s",
level=numeric_level)
level=numeric_level,
filename=options.logfile)
logging.debug(str(options))
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment