Made thread logs prettier

This commit is contained in:
Ganesh Gore 2019-08-22 16:56:58 -06:00
parent 764d7039b5
commit d5ce1b557e
1 changed files with 12 additions and 1 deletions

View File

@ -88,6 +88,7 @@ def validate_command_line_arguments():
if args.debug: if args.debug:
logger.info("Setting loggger in debug mode") logger.info("Setting loggger in debug mode")
logger.setLevel(logging.DEBUG) logger.setLevel(logging.DEBUG)
logger.info("Set up to run %d Parallel threads", args.maxthreads)
def generate_each_task_actions(taskname): def generate_each_task_actions(taskname):
@ -239,6 +240,16 @@ def create_run_command(curr_job_dir, archfile, benchmark_obj, task_conf):
return command return command
def strip_child_logger_info(line):
try:
logtype, message = line.split(" - ", 1)
lognumb = {"CRITICAL": 50, "ERROR": 40, "WARNING": 30,
"INFO": 20, "DEBUG": 10, "NOTSET": 0}
logger.log(lognumb["INFO"], message)
except:
logger.info(line)
def run_single_script(s, eachJob): def run_single_script(s, eachJob):
logger.debug('Added job in pool') logger.debug('Added job in pool')
with s: with s:
@ -257,7 +268,7 @@ def run_single_script(s, eachJob):
universal_newlines=True) universal_newlines=True)
for line in process.stdout: for line in process.stdout:
if not args.skip_tread_logs: if not args.skip_tread_logs:
logging.info(line[:-1]) strip_child_logger_info(line[:-1])
sys.stdout.buffer.flush() sys.stdout.buffer.flush()
output.write(line) output.write(line)
process.wait() process.wait()