Skip to content

Commit bf0aed6

Browse files
committed
Merge init_log & init_log_item functiions
1 parent f12514a commit bf0aed6

File tree

2 files changed

+6
-9
lines changed

2 files changed

+6
-9
lines changed

src/fosslight_source/convert_scancode.py

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@
1111
import logging
1212
import fosslight_util.constant as constant
1313
from fosslight_util.set_log import init_log
14-
from fosslight_util.set_log import init_log_item
1514
import yaml
1615
from ._parsing_scancode_file_item import parsing_file_item, get_error_from_header
1716
from fosslight_util.write_excel import write_excel_and_csv
@@ -21,9 +20,8 @@
2120
_PKG_NAME = "fosslight_source"
2221

2322

24-
def convert_json_to_excel(scancode_json, excel_name):
23+
def convert_json_to_excel(scancode_json, excel_name, _result_log):
2524
file_list = []
26-
_result_log = init_log_item(_PKG_NAME)
2725
msg = ""
2826
success = True
2927

@@ -117,9 +115,9 @@ def main():
117115
oss_report_name = output_file_name
118116
output_dir = os.path.dirname(os.path.abspath(output_file_name))
119117

120-
logger = init_log(os.path.join(output_dir, "fosslight_src_log_" + start_time + ".txt"))
121-
122-
convert_json_to_excel(path_to_find_bin, oss_report_name)
118+
logger, _result_log = init_log(os.path.join(output_dir, "fosslight_src_log_" + start_time + ".txt"),
119+
True, logging.INFO, logging.DEBUG, _PKG_NAME)
120+
convert_json_to_excel(path_to_find_bin, oss_report_name, _result_log)
123121

124122

125123
if __name__ == '__main__':

src/fosslight_source/run_scancode.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@
1515
from datetime import datetime
1616
import fosslight_util.constant as constant
1717
from fosslight_util.set_log import init_log
18-
from fosslight_util.set_log import init_log_item
1918
from fosslight_util.timer_thread import TimerThread
2019
from ._parsing_scancode_file_item import parsing_file_item
2120
from ._parsing_scancode_file_item import get_error_from_header
@@ -76,8 +75,8 @@ def run_scan(path_to_scan, output_file_name="",
7675
output_json_file = output_file_name
7776
output_dir = os.path.dirname(os.path.abspath(output_file_name))
7877

79-
logger = init_log(os.path.join(output_dir, "fosslight_src_log_"+start_time+".txt"))
80-
_result_log = init_log_item(_PKG_NAME, path_to_scan)
78+
logger = init_log(os.path.join(output_dir, "fosslight_src_log_"+start_time+".txt"),
79+
True, logging.INFO, logging.DEBUG, _PKG_NAME, path_to_scan)
8180

8281
if path_to_scan == "":
8382
if _windows:

0 commit comments

Comments
 (0)