Logo Search packages:      
Sourcecode: mago version File versions  Download package

def mago::cmd::main::convert_log_file (   log_file  ) 

Transform xml log format into html report

Definition at line 46 of file main.py.

00046                               :
    """
    Transform xml log format into html report
    """
    if os.path.exists(globals.SCREENSHOTS_SHARE):
        screenshot_dir = os.path.join(os.path.dirname(log_file),
                                      "screenshots")

        if not os.path.exists(screenshot_dir):            
            safe_make_directory(screenshot_dir)

        if len(os.listdir(globals.SCREENSHOTS_SHARE)) > 0:
            command = "mv " + globals.SCREENSHOTS_SHARE + "/* " + screenshot_dir
            safe_run_command(command)

    log_file_tmp = log_file + ".tmp"
    o = open(log_file_tmp, "w")
    data = open(log_file).read()
    o.write(re.sub(globals.SCREENSHOTS_SHARE, "screenshots", data))
    o.flush()
    o.close()
    
    os.remove(log_file)
    os.rename(log_file_tmp, log_file)

    xsl_file = os.path.join(globals.MAGO_SHARE, "report.xsl")
    if not os.path.exists(xsl_file):
        logging.error("XSL file `%s' does not exist." % xsl_file)
        sys.exit(1)

    html_file = log_file.replace(".log", ".html")

    command = "xsltproc -o %s %s %s" \
        % (html_file, xsl_file, log_file)
    safe_run_command(command)
 

def configure_logging(log_level_str, log_filename):


Generated by  Doxygen 1.6.0   Back to index