From 5d6da3b24e8cdc71bfea01444d44b6013a6c041b Mon Sep 17 00:00:00 2001 From: Chuck SmileyRekiere Date: Mon, 19 Apr 2021 13:41:31 -0600 Subject: [PATCH] lf_report.py , lf_snp_test.py : add reporting --- py-scripts/lf_report.py | 5 +++++ py-scripts/lf_snp_test.py | 37 +++++++++++++++++++++++++------------ 2 files changed, 30 insertions(+), 12 deletions(-) diff --git a/py-scripts/lf_report.py b/py-scripts/lf_report.py index 4aaeb679..30bc4225 100755 --- a/py-scripts/lf_report.py +++ b/py-scripts/lf_report.py @@ -179,6 +179,11 @@ class lf_report(): def get_report_path(self): return self.path_date_time + def file_location(self, file): + output_file = str(self.path_date_time)+'/'+ str(file) + print("output file {}".format(output_file)) + return output_file + def write_html(self): self.write_output_html = str(self.path_date_time)+'/'+ str(self.output_html) print("write_output_html: {}".format(self.write_output_html)) diff --git a/py-scripts/lf_snp_test.py b/py-scripts/lf_snp_test.py index 01f08c10..d4f02883 100755 --- a/py-scripts/lf_snp_test.py +++ b/py-scripts/lf_snp_test.py @@ -54,6 +54,9 @@ import re import csv import random import logging +from lf_report import lf_report +from lf_graph import lf_bar_graph + FORMAT = '%(asctime)s %(name)s %(levelname)s: %(message)s' @@ -1594,18 +1597,6 @@ LANforge GUI what is displayed in the Column and how to access the value with cl if args.radio: radios = args.radio - if args.csv_outfile != None: - current_time = time.strftime("%m_%d_%Y_%H_%M_%S", time.localtime()) - csv_outfile = "{}_{}.csv".format(args.csv_outfile,current_time) - csv_results = "results_{}_{}.csv".format(args.csv_outfile,current_time) - print("csv output file : {}".format(csv_outfile)) - - if args.log: - outfile_log = "{}_{}_output_log.log".format(args.outfile,current_time) - print("output file log: {}".format(outfile_log)) - else: - outfile_log = "stdout" - print("output file log: {}".format(outfile_log)) if args.wait_timeout: wait_timeout = int(args.wait_timeout) @@ -1652,6 +1643,28 @@ LANforge GUI what is displayed in the Column and how to access the value with cl exit(1) print("ap_dict: {}".format(ap_dict)) + # Logging information + report = lf_report() + + if args.csv_outfile != None: + current_time = time.strftime("%m_%d_%Y_%H_%M_%S", time.localtime()) + csv_outfile = "{}_{}.csv".format(args.csv_outfile,current_time) + csv_outfile = report.file_add_path(csv_outfile) + + csv_results = "results_{}_{}.csv".format(args.csv_outfile,current_time) + csv_results = report.file_add_path(csv_results) + print("csv output file : {}".format(csv_outfile)) + print("csv results file : {}".format(csv_results)) + + if args.log: + outfile_log = "{}_{}_output_log.log".format(args.outfile,current_time) + outfile_log = report.file_add_path(outfile_log) + print("output file log: {}".format(outfile_log)) + else: + outfile_log = "stdout" + print("output file log: {}".format(outfile_log)) + + # Set up the log file console_handler = logging.StreamHandler() formatter = logging.Formatter(FORMAT) logg = logging.getLogger(__name__)