def main(): log_dir = "out-log" if os.path.exists(log_dir): shutil.rmtree(log_dir) os.mkdir(log_dir) maker = build_log.LogDir(log_dir) log = maker.make_logger() run_cmd(log, ["echo", "Hello world!"]) log2 = log.child_log("child") log2.message("This is a message") log2.finish(0) log.finish(0) print etree.tostring(maker.get_xml(), pretty_print=True) html = build_log.wrap_body(build_log.format_log(maker.get_xml())) write_file(os.path.join("out-log", "log.html"), etree.tostring(html, pretty_print=True))
def main(argv): parser = optparse.OptionParser(__doc__.strip()) parser.add_option( "--short", default=False, dest="short", action="store_true", help="Short version, only showing top-level items and errors") options, args = parser.parse_args(argv) log_dir, output_file = args logset = build_log.LogSetDir(log_dir) body = build_log.tag("body") for log in logset.get_logs(): if options.short: xml = build_log.format_short_summary( log.get_xml(), build_log.NullPathnameMapper()) else: xml = build_log.format_top_log( log.get_xml(), build_log.NullPathnameMapper()) body.append(xml) body.append(tag("hr")) build_log.write_xml_file(output_file, build_log.wrap_body(body))