def format(self, record):
level = record.levelno<EOL>if level >= logging.CRITICAL:<EOL><INDENT>color = self.CRITICAL<EOL><DEDENT>elif level >= logging.ERROR:<EOL><INDENT>color = self.ERROR<EOL><DEDENT>elif level >= logging.WARNING:<EOL><INDENT>color = self.WARNING<EOL><DEDENT>elif level >= logging.INFO:<EOL><INDENT>color = self.INFO<EOL><DEDENT>elif level >= logging.DEBUG:<EOL><INDENT>color = self.DEBUG<EOL><DEDENT>else:<EOL><INDENT>color = self.DEFAULT<EOL><DEDENT>message = super().format(record)<EOL>if record.args:<EOL><INDENT>try:<EOL><INDENT>message = message % record.args<EOL><DEDENT>except TypeError:<EOL><INDENT>pass<EOL><DEDENT><DEDENT>return color + message + self.DEFAULT<EOL>
Adds colors to a log record and formats it with the default

Args:
    record (logging.LogRecord): log record to format

Returns:
    str: The colored and formatted record string