def METHOD_NAME(str):
    if globals.OPTS.output_name != '':
        if METHOD_NAME.create_file:
            # We may have not yet read the config, so we need to ensure
            # it ends with a /
            # This is also done in read_config if we change the path
            # FIXME: There's actually a bug here. The first few lines
            # could be in one log file and after read_config it could be
            # in another log file if the path or name changes.
            if not globals.OPTS.output_path.endswith('/'):
                globals.OPTS.output_path += "/"
            if not os.path.isdir(globals.OPTS.output_path):
                os.mkdir(globals.OPTS.output_path)
            compile_log = open(globals.OPTS.output_path +
                               globals.OPTS.output_name + '.log', "w+")
            METHOD_NAME.create_file = 0
        else:
            compile_log = open(globals.OPTS.output_path +
                               globals.OPTS.output_name + '.log', "a")
        if len(METHOD_NAME.setup_output) != 0:
            for line in METHOD_NAME.setup_output:
                compile_log.write(line)
            METHOD_NAME.setup_output = []
        compile_log.write(str + '\n')
    else:
        METHOD_NAME.setup_output.append(str + "\n")