Exemplo n.º 1
0
def fetch_lines_from_error_log(count):
    if not os.path.isfile("errorLogs.db"):
        return "The error log database does not exist."
    if count <= 0:
        return "Please request an exception count greater than zero."
    logs = ErrorLogs.fetch_last(count)
    s = '\n'.join([
        "### {2} on {0} at {1}Z: {3}\n{4}".format(
            GlobalVars.location, datetime.utcfromtimestamp(time).isoformat()[:-7],
            name, message, tb)
        for time, name, message, tb in logs])
    if s:
        return s
    else:
        return "The fetched log is empty."
Exemplo n.º 2
0
def fetch_lines_from_error_log(count):
    if not os.path.isfile("errorLogs.db"):
        return "The error log database does not exist."
    if count <= 0:
        return "Please request an exception count greater than zero."
    logs = ErrorLogs.fetch_last(count)
    s = '\n'.join([
        "### {2} on {0} at {1}Z: {3}\n{4}".format(
            GlobalVars.location, datetime.utcfromtimestamp(time).isoformat()[:-7],
            name, message, tb)
        for time, name, message, tb in logs])
    if s:
        return redact_passwords(s)
    else:
        return "The fetched log is empty."