From 2dec2e6a70808f6bf08cfa268bd4b8189e03ade0 Mon Sep 17 00:00:00 2001 From: Shay Nehmad Date: Sun, 6 Oct 2019 19:59:40 +0300 Subject: [PATCH] Improved log parser logs --- .../blackbox/log_handlers/monkey_log_parser.py | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/envs/monkey_zoo/blackbox/log_handlers/monkey_log_parser.py b/envs/monkey_zoo/blackbox/log_handlers/monkey_log_parser.py index cf55d5626..ae0911431 100644 --- a/envs/monkey_zoo/blackbox/log_handlers/monkey_log_parser.py +++ b/envs/monkey_zoo/blackbox/log_handlers/monkey_log_parser.py @@ -13,9 +13,12 @@ class MonkeyLogParser(object): def print_errors(self): errors = MonkeyLogParser.get_errors(self.log_contents) - print("Found {} errors:".format(len(errors))) - for error_line in errors: - print(error_line) + if len(errors) > 0: + print("Found {} errors:".format(len(errors))) + for error_line in errors: + print(error_line) + else: + print("No errors!") @staticmethod def get_errors(log_contents): @@ -24,9 +27,12 @@ class MonkeyLogParser(object): def print_warnings(self): warnings = MonkeyLogParser.get_warnings(self.log_contents) - print("Found {} warnings:".format(len(warnings))) - for warning_line in warnings: - print(warning_line) + if len(warnings) > 0: + print("Found {} warnings:".format(len(warnings))) + for warning_line in warnings: + print(warning_line) + else: + print("No warnings!") @staticmethod def get_warnings(log_contents):