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
965934
def format(self, record):
        
        level = record.levelno

        if level >= logging.CRITICAL:
            color = self.CRITICAL
        elif level >= logging.ERROR:
            color = self.ERROR
        elif level >= logging.WARNING:
            color = self.WARNING
        elif level >= logging.INFO:
            color = self.INFO
        elif level >= logging.DEBUG:
            color = self.DEBUG
        else:
            color = self.DEFAULT

        message = super().format(record)
        if record.args:
            try:
                message = message % record.args
            except TypeError:
                # this happens when the message itself has some %s symbols, as
                # in traces for tracedumps
                pass

        return color + message + self.DEFAULT
932208
function (record) {
      var recordToSend = { object: record };

      recordToSend.columnValues = this.getRecordColumnValues(record);
      recordToSend.searchKeywords = this.getRecordKeywords(record);
      recordToSend.filterValues = this.getRecordFilterValues(record);
      recordToSend.color = this.getRecordColor(record);

      return recordToSend;
    }
1347571
def format(self, record):
        
        formatted = super(IndentingFormatter, self).format(record)
        prefix = ''
        if self.add_timestamp:
            prefix = self.formatTime(record, "%Y-%m-%dT%H:%M:%S ")
        prefix += " " * get_indentation()
        formatted = "".join([
            prefix + line
            for line in formatted.splitlines(True)
        ])
        return formatted
275262
def format_graylog_v0(self, record):
        '''
        
        '''
        message_dict = {
            'message': record.getMessage(),
            'timestamp': self.formatTime(record),
            # Graylog uses syslog levels, not whatever it is Python does...
            'level': syslog_levels.get(record.levelname, 'ALERT'),
            'tag': self.tag
        }

        if record.exc_info:
            exc_info = self.formatException(record.exc_info)
            message_dict.update({'full_message': exc_info})

        # Add any extra attributes to the message field
        for key, value in six.iteritems(record.__dict__):
            if key in ('args', 'asctime', 'bracketlevel', 'bracketname', 'bracketprocess',
                       'created', 'exc_info', 'exc_text', 'id', 'levelname', 'levelno', 'msecs',
                       'msecs', 'message', 'msg', 'relativeCreated', 'version'):
                # These are already handled above or explicitly pruned.
                continue

            if isinstance(value, (six.string_types, bool, dict, float, int, list, types.NoneType)):  # pylint: disable=W1699
                val = value
            else:
                val = repr(value)
            message_dict.update({'{0}'.format(key): val})
        return message_dict
881295
def format(self, record):
        
        return {
            'timestamp': int(float(record.created or time.time()) * 1000),
            'message': record.msg or '',
            'level': record.levelname or 'DEBUG',
        }
1253223
def format(self, record):
        

        try:
            n = record.n
        except AttributeError:
            n = 'default'

        try:
            message = record.message
        except AttributeError:
            message = record.msg

        senml = OrderedDict(
            uid="hyperstream",
            bt=datetime.utcfromtimestamp(record.created).isoformat()[:-3] + 'Z',
            e=[OrderedDict(n=n, v=message)]
        )

        formatted_json = json.dumps(senml)
        return formatted_json
966108
def format(self, record):
        
        self._format_record(record)

        record_dict = {}
        for k, v in record.__dict__.items():
            if isinstance(k, str):
                k = decode_(k, 'utf8')
            if isinstance(v, str):
                v = decode_(v, 'utf8', 'replace')
            record_dict[k] = v

        if 'color' in self.fmt or 'end_color' in self.fmt:
            record_dict['color'], record_dict['end_color'] = _color(record.levelno)

        log = self.ufmt % record_dict

        if record.exc_text:
            if log[-1:] != '\n':
                log += '\n'
            log += decode_(record.exc_text, 'utf8', 'replace')

        log = log.replace('\n', '\n' + self.tab)

        return log
9442
def addRecord(self, record):
        
        if self._destroyed:
            return
        
        if not self.uiRecordBTN.isChecked():
            return
        
        self._queue.append(record)
408809
def format(self, record):
        
        level_length = len(record.levelname)
        if record.levelname in self._colors_map:
            record.msg = '{0}{1}\033[0;0m'.format(
                self._colors_map[record.levelname],
                record.msg
            )
            record.levelname = '{0}{1}\033[0;0m'.format(
                self._colors_map[record.levelname],
                record.levelname
            )
        record.levelname += ' ' * (8 - level_length)
        record.name = '\033[37m\033[1m{0}\033[0;0m'.format(record.name)
        return super(ColorFormatter, self).format(record)
146417
def format(self, record):
        
        out = dict(
            Timestamp=int(record.created * 1e9),
            Type=record.name,
            Logger=self.logger_name,
            Hostname=self.hostname,
            EnvVersion=self.LOGGING_FORMAT_VERSION,
            Severity=self.SYSLOG_LEVEL_MAP.get(record.levelno,
                                               self.DEFAULT_SYSLOG_LEVEL),
            Pid=record.process,
        )

        # Include any custom attributes set on the record.
        # These would usually be collected metrics data.
        fields = dict()
        for key, value in record.__dict__.items():
            if key not in self.EXCLUDED_LOGRECORD_ATTRS:
                fields[key] = value

        # Only include the 'message' key if it has useful content
        # and is not already a JSON blob.
        message = record.getMessage()
        if message:
            if not message.startswith("{") and not message.endswith("}"):
                fields["msg"] = message

        # If there is an error, format it for nice output.
        if record.exc_info is not None:
            fields["error"] = repr(record.exc_info[1])
            fields["traceback"] = safer_format_traceback(*record.exc_info)

        out['Fields'] = fields

        return json.dumps(out)
668771
@Override
  public synchronized String format(final LogRecord record) {
    buffer.setLength(PREFIX.length());
    buffer.append(timestampFormatter.format(new Date(record.getMillis())));
    buffer.append(' ');
    buffer.append(levelNumberToCommonsLevelName(record.getLevel()));
    String[] parts = record.getSourceClassName().split("\\.");
    buffer.append(" [" + parts[parts.length-1] + "." + record.getSourceMethodName() + "]");
    buffer.append(SUFFIX);
    buffer.append(formatMessage(record)).append(lineSeparator);
    if (record.getThrown() != null) {
      final StringWriter trace = new StringWriter();
      record.getThrown().printStackTrace(new PrintWriter(trace));
      buffer.append(trace);
    }

    return buffer.toString();
  }
315353
def format(self, record) -> str:
        
        msg = dict(self.formatter_fields_for_record(record))
        if record.flatten and isinstance(record.msg, dict):
            msg.update(record.msg)
        else:
            msg[MSG_FIELDNAME] = record.msg

        if record.extra:
            msg.update(record.extra)
        if record.exc_info:
            msg["exc_info"] = record.exc_info
        if record.exc_text:
            msg["exc_text"] = record.exc_text

        return self.serializer(
            msg, default=self._default_handler, **record.serializer_kwargs
        )
1317329
def emit(self, record):
        
        try:
            msg = self.format(record)
            level = _STORM_LOG_LEVELS.get(record.levelname.lower(), _STORM_LOG_INFO)
            self.serializer.send_message(
                {"command": "log", "msg": str(msg), "level": level}
            )
        except Exception:
            self.handleError(record)
41621
def format(self, record):
        

        fields = record.__dict__.copy()

        if isinstance(record.msg, dict):
            fields.update(record.msg)
            fields.pop('msg')
            msg = ""
        else:
            msg = record.getMessage()

        try:
            msg = msg.format(**fields)
        except (KeyError, IndexError, ValueError):
            pass
        except:
            # in case we can not format the msg properly we log it as is instead of crashing
            msg = msg

        if 'msg' in fields:
            fields.pop('msg')

        if 'exc_info' in fields:
            if fields['exc_info']:
                formatted = tb.format_exception(*fields['exc_info'])
                fields['exception'] = formatted
            fields.pop('exc_info')

        if 'exc_text' in fields and not fields['exc_text']:
            fields.pop('exc_text')

        logr = self.defaults.copy()

        logr.update({'@message': msg,
                     '@timestamp': datetime.datetime.utcnow().strftime('%Y-%m-%dT%H:%M:%S.%fZ'),
                     '@source_host': self.source_host,
                     '@fields': self._build_fields(logr, fields)})

        return json.dumps(logr, default=self.json_default, cls=self.json_cls)
1147931
def format(self, record):
        
        if record.exc_info:
            if record.exc_text:
                if "Stack frames (most recent call first)" not in record.exc_text:
                    record.exc_text = None
        return super(LocalVarFormatter, self).format(record)
570944
def default_log_template(self, record):
    

    reset = Style.RESET_ALL
    levelname = [
        LEVEL_COLORS.get(record.levelname),
        Style.BRIGHT,
        '(%(levelname)s)',
        Style.RESET_ALL,
        ' ',
    ]
    asctime = [
        '[',
        Fore.BLACK,
        Style.DIM,
        Style.BRIGHT,
        '%(asctime)s',
        Fore.RESET,
        Style.RESET_ALL,
        ']',
    ]
    name = [
        ' ',
        Fore.WHITE,
        Style.DIM,
        Style.BRIGHT,
        '%(name)s',
        Fore.RESET,
        Style.RESET_ALL,
        ' ',
    ]

    tpl = "".join(reset + levelname + asctime + name + reset)

    return tpl
513095
def format(self, record):
        """"""
        # XXX: idea, colorize message arguments
        s = super(ANSIFormatter, self).format(record)
        if hasattr(self.context, 'ansi'):
            s = self.context.ansi(s, **self.get_sgr(record))
        return s