def print_log_entries(logEntries, apache_type):
    """
        Print log lines that fit the apache type.

        Either access or error.
    """
    if apache_type == 'access':
        if has_str_format:
            for entry in logEntries:
                dt = datetime.fromtimestamp(float(entry["time"]))
                entry["time"] = dt.strftime('[%d/%b/%Y:%H:%M:%S +0000]')
                try:
                    print r'{0} {1} {2} {3} "{4}" {5} {6} "{7}" "{8}"'.format(
                        entry["remote_host"],
                        entry["remote_logname"],
                        entry["remote_user"],
                        entry["time"],
                        entry["first_request_line"],
                        entry["status"],
                        entry["response_size_CLF"],
                        entry["referer"],
                        entry["user_agent"])
                except KeyError:
                    pass
        else:
            for entry in logEntries:
                dt = datetime.fromtimestamp(float(entry["time"]))
                entry["time"] = dt.strftime('[%d/%b/%Y:%H:%M:%S +0000]')
                try:
                    print r'%s %s %s %s "%s" %s %s "%s" "%s"' % (
                        entry["remote_host"],
                        entry["remote_logname"],
                        entry["remote_user"],
                        entry["time"],
                        entry["first_request_line"],
                        entry["status"],
                        entry["response_size_CLF"],
                        entry["referer"],
                        entry["user_agent"])
                except __HOLE__:
                    pass
    elif apache_type == 'error':
        if has_str_format:
            for entry in logEntries:
                dt = datetime.fromtimestamp(float(entry["time"]))
                entry["time"] = dt.strftime('[%a %b %d %H:%M:%S %Y]')
                print r'{0} {1} {2}'.format(
                    entry["time"],
                    entry["type"],
                    entry["message"].encode('utf-8'))
        else:
            for entry in logEntries:
                dt = datetime.fromtimestamp(float(entry["time"]))
                entry["time"] = dt.strftime('[%a %b %d %H:%M:%S %Y]')
                print r'%s %s %s' % (
                    entry["time"],
                    entry["type"],
                    entry["message"].encode('utf-8'))
    elif apache_type == 'worker':
        if has_str_format:
            for entry in logEntries:
                dt = datetime.fromtimestamp(float(entry["time"]))
                entry["time"] = dt.strftime('[%a %b %d %H:%M:%S %Y]')
                print r'{0} {1} {2}'.format(
                    entry["time"],
                    entry["wrk_id"],
                    entry["message"].encode('utf-8'))
        else:
            for entry in logEntries:
                dt = datetime.fromtimestamp(float(entry["time"]))
                entry["time"] = dt.strftime('[%a %b %d %H:%M:%S %Y]')
                print r'%s %s %s' % (
                    entry["time"],
                    entry["wrk_id"],
                    entry["message"].encode('utf-8'))
    elif apache_type == 'deploy':
        if has_str_format:
            for entry in logEntries:
                dt = datetime.fromtimestamp(float(entry["time"]))
                entry["time"] = dt.strftime('[%a %b %d %H:%M:%S %Y]')
                print r'{0} {1} {2} {3}'.format(
                    entry["time"],
                    entry['hostname'],
                    entry["level"],
                    entry["message"].encode('utf-8'))
        else:
            for entry in logEntries:
                dt = datetime.fromtimestamp(float(entry["time"]))
                entry["time"] = dt.strftime('[%a %b %d %H:%M:%S %Y]')
                print r'%s %s %s %s' % (
                    entry["time"],
                    entry['hostname'],
                    entry["level"],
                    entry["message"].encode('utf-8'))
dataset/ETHPy150Open cloudControl/cctrl/cctrl/output.py/print_log_entries