specify logging level from CLI

This commit is contained in:
debugtalk
2017-07-03 16:40:59 +08:00
parent f833fe9143
commit a409beb548
2 changed files with 8 additions and 2 deletions

View File

@@ -9,8 +9,6 @@ from requests.exceptions import (InvalidSchema, InvalidURL, MissingSchema,
from ate.exception import ParamsError
log_level = getattr(logging, "INFO")
logging.basicConfig(level=log_level)
absolute_http_url_regexp = re.compile(r"^https?://", re.I)

View File

@@ -1,4 +1,5 @@
import argparse
import logging
import unittest
from ate import runner, utils
@@ -56,7 +57,14 @@ def main():
parser.add_argument(
'--testcase-path', default='testcases',
help="testcase file path")
parser.add_argument(
'--log-level', default='INFO',
help="Specify logging level, default is INFO.")
args = parser.parse_args()
log_level = getattr(logging, args.log_level.upper())
logging.basicConfig(level=log_level)
task_suite = create_task(args.testcase_path)
unittest.TextTestRunner().run(task_suite)