diff --git a/src/fosslight_source/convert_scancode.py b/src/fosslight_source/convert_scancode.py index 4130a3e..9faf178 100755 --- a/src/fosslight_source/convert_scancode.py +++ b/src/fosslight_source/convert_scancode.py @@ -11,7 +11,6 @@ import logging import fosslight_util.constant as constant from fosslight_util.set_log import init_log -from fosslight_util.set_log import init_log_item import yaml from ._parsing_scancode_file_item import parsing_file_item, get_error_from_header from fosslight_util.write_excel import write_excel_and_csv @@ -21,9 +20,8 @@ _PKG_NAME = "fosslight_source" -def convert_json_to_excel(scancode_json, excel_name): +def convert_json_to_excel(scancode_json, excel_name, _result_log): file_list = [] - _result_log = init_log_item(_PKG_NAME) msg = "" success = True @@ -117,9 +115,9 @@ def main(): oss_report_name = output_file_name output_dir = os.path.dirname(os.path.abspath(output_file_name)) - logger = init_log(os.path.join(output_dir, "fosslight_src_log_" + start_time + ".txt")) - - convert_json_to_excel(path_to_find_bin, oss_report_name) + logger, _result_log = init_log(os.path.join(output_dir, "fosslight_src_log_" + start_time + ".txt"), + True, logging.INFO, logging.DEBUG, _PKG_NAME) + convert_json_to_excel(path_to_find_bin, oss_report_name, _result_log) if __name__ == '__main__': diff --git a/src/fosslight_source/run_scancode.py b/src/fosslight_source/run_scancode.py index d85d304..d854df5 100755 --- a/src/fosslight_source/run_scancode.py +++ b/src/fosslight_source/run_scancode.py @@ -15,7 +15,6 @@ from datetime import datetime import fosslight_util.constant as constant from fosslight_util.set_log import init_log -from fosslight_util.set_log import init_log_item from fosslight_util.timer_thread import TimerThread from ._parsing_scancode_file_item import parsing_file_item from ._parsing_scancode_file_item import get_error_from_header @@ -76,8 +75,8 @@ def run_scan(path_to_scan, output_file_name="", output_json_file = output_file_name output_dir = os.path.dirname(os.path.abspath(output_file_name)) - logger = init_log(os.path.join(output_dir, "fosslight_src_log_"+start_time+".txt")) - _result_log = init_log_item(_PKG_NAME, path_to_scan) + logger, _result_log = init_log(os.path.join(output_dir, "fosslight_src_log_"+start_time+".txt"), + True, logging.INFO, logging.DEBUG, _PKG_NAME, path_to_scan) if path_to_scan == "": if _windows: diff --git a/tests/cli_test.py b/tests/cli_test.py index 20618b3..bf00d87 100755 --- a/tests/cli_test.py +++ b/tests/cli_test.py @@ -23,7 +23,7 @@ def main(): fosslight_report_name = "test_result_func_call/result" output_dir = os.path.dirname(os.path.abspath(output_file_name)) - logger = init_log(os.path.join(output_dir, "fosslight_src_log_"+start_time+".txt")) + logger, result_item = init_log(os.path.join(output_dir, "fosslight_src_log_"+start_time+".txt")) ret = run_scan(path_to_find_bin, fosslight_report_name, True, -1, True) diff --git a/tox.ini b/tox.ini index d774e6e..da3d272 100644 --- a/tox.ini +++ b/tox.ini @@ -24,7 +24,7 @@ commands = cat test_scan/scan_result.csv fosslight_convert -p tests/json_result/scan_has_error.json -o test_convert/convert_result2 fosslight_convert -p test_scan/scan_result.json -o test_convert/convert_result - cat test_convert/convert_result.csv + cat test_convert/convert_result_SRC.csv python tests/cli_test.py [testenv:release] @@ -35,9 +35,9 @@ commands = fosslight_source -h fosslight_convert -h fosslight_source -p tests/test_files -j -o test_scan/scan_result - cat test_scan/scan_result.csv + cat test_scan/scan_result_SRC.csv fosslight_convert -p tests/json_result/scan_has_error.json -o test_convert/convert_result2 fosslight_convert -p test_scan/scan_result.json -o test_convert/convert_result - cat test_convert/convert_result.csv + cat test_convert/convert_result_SRC.csv python tests/cli_test.py pytest -v --flake8