def step_impl(context): badlines, _errors, _warnings = analyselog(context.log) assert len(badlines) == 0,\ ("Found following errors and/or warnings lines in the logfile:\n" + "".join(badlines) + "For details see %s" % context.log)
def step_impl(context): ignore_re = build_regexp(context.text) badlines, _errors, _warnings = analyselog(context.log, ignore_re) assert len(badlines) == 0, ( "Found following errors and/or warnings lines in the logfile:\n" + "".join(badlines) + "For details see %s" % context.log )
def checklogs(sonarhome): sys.stdout.write(INDENT + "logs check ... ") sys.stdout.flush() badlines, errors, warnings = analyselog(sonarlog(sonarhome)) reslabel = GREEN + "OK\n" if errors > 0 or (errors == 0 and warnings == 0 and len(badlines) > 0): reslabel = RED + "FAILED\n" elif warnings > 0: reslabel = YELLOW + "WARNINGS\n" sys.stdout.write(reslabel + RESET) if badlines: for line in badlines: sys.stdout.write(2*INDENT + line) summary_msg = "%i errors and %i warnings\n" % (errors, warnings) return errors == 0
def checklogs(sonarhome): sys.stdout.write(INDENT + "logs check ... ") sys.stdout.flush() badlines, errors, warnings = analyselog(sonarlog(sonarhome)) reslabel = GREEN + "OK\n" if errors > 0 or (errors == 0 and warnings == 0 and len(badlines) > 0): reslabel = RED + "FAILED\n" elif warnings > 0: reslabel = YELLOW + "WARNINGS\n" sys.stdout.write(reslabel + RESET) if badlines: for line in badlines: sys.stdout.write(2 * INDENT + line) summary_msg = "%i errors and %i warnings\n" % (errors, warnings) print(2 * INDENT + len(summary_msg) * "-") print(2 * INDENT + summary_msg) return errors == 0