:type record: aiologger.loggers.json.LogRecord
961267
def formatter_fields_for_record(self, record):
        
        datetime_serialized = (
            datetime.now(timezone.utc).astimezone(self.tz).isoformat()
        )

        default_fields = (
            (LOGGED_AT_FIELDNAME, datetime_serialized),
            (LINE_NUMBER_FIELDNAME, record.lineno),
            (FUNCTION_NAME_FIELDNAME, record.funcName),
            (LOG_LEVEL_FIELDNAME, self.level_to_name_mapping[record.levelno]),
            (FILE_PATH_FIELDNAME, record.pathname),
        )

        for field, value in default_fields:
            if field in self.log_fields:
                yield field, value
845020
def __store_record(self, record):
		
		if isinstance(record, WSimpleTrackerStorage.Record) is False:
			raise TypeError('Invalid record type was')
		limit = self.record_limit()
		if limit is not None and len(self.__registry) >= limit:
			self.__registry.pop(0)
		self.__registry.append(record)
89765
def record_serializer(self):
        """"""
        imp = current_app.config['GITHUB_RECORD_SERIALIZER']
        if isinstance(imp, string_types):
            return import_string(imp)
        return imp
1111539
def _load_records(self, record_type_idstrs):
        """"""
        for record_type_idstr in record_type_idstrs:
            try:
                self._init_record(record_type_idstr)
            except (ImportError, KeyError):
                pass
1116739
def record(self):
        # type: () -> bytes
        '''
        
        '''
        if not self._initialized:
            raise pycdlibexception.PyCdlibInternalError('PL record not yet initialized!')

        return b'PL' + struct.pack('=BBLL', RRPLRecord.length(), SU_ENTRY_VERSION, self.parent_log_block_num, utils.swab_32bit(self.parent_log_block_num))
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)
926257
def emit(self, record):
        

        pid = os.getpid()
        if pid != self.pid:
            self.pid = pid
            self.logs = []
            self.timer = self._flushAndRepeatTimer()
            atexit.register(self._stopFlushTimer)

        # avoid infinite recursion
        if record.name.startswith('requests'):
            return

        self.logs.append(self._prepPayload(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)
1098203
def record(self):
        

        modules = []
        scripts = []
        if self.get_content_of_file('RECORD'):
            lines = self.get_content_of_file('RECORD').splitlines()
            for line in lines:
                if 'dist-info' in line or '/' not in line:
                    continue
                elif '.data/scripts' in line:
                    script = line.split(',', 1)[0]
                    # strip Name.version.data/scripts/
                    scripts.append(re.sub('.*/.*/', '', script))
                else:
                    # strip everything from first occurance of slash
                    modules.append(re.sub('/.*', '', line))

        return {'modules': sorted(set(modules)),
                'scripts': sorted(set(scripts))}
78391
def _log(self, level, msg, *args, **kwargs):
        
        if not isinstance(level, int):
            if logging.raiseExceptions:
                raise TypeError('Level must be an integer!')
            else:
                return

        if self.logger.isEnabledFor(level=level):
            """
            Low-level logging routine which creates a LogRecord and then calls
            all the handlers of this logger to handle the record.
            """
            exc_info = kwargs.get('exc_info', None)
            extra = kwargs.get('extra', None)
            stack_info = kwargs.get('stack_info', False)
            record_filter = kwargs.get('record_filter', None)

            tb_info = None
            if _logone_src:
                # IronPython doesn't track Python frames, so findCaller raises an
                # exception on some versions of IronPython. We trap it here so that
                # IronPython can use logging.
                try:
                    fn, lno, func, tb_info = self.__find_caller(stack_info=stack_info)
                except ValueError:  # pragma: no cover
                    fn, lno, func = '(unknown file)', 0, '(unknown function)'
            else:  # pragma: no cover
                fn, lno, func = '(unknown file)', 0, '(unknown function)'

            if exc_info:
                if sys.version_info[0] >= 3:
                    if isinstance(exc_info, BaseException):
                        # noinspection PyUnresolvedReferences
                        exc_info = type(exc_info), exc_info, exc_info.__traceback__
                    elif not isinstance(exc_info, tuple):
                        exc_info = sys.exc_info()
                else:
                    if not isinstance(exc_info, tuple):
                        exc_info = sys.exc_info()

            if sys.version_info[0] >= 3:
                # noinspection PyArgumentList
                record = self.logger.makeRecord(self.name, level, fn, lno, msg, args,
                                                exc_info, func, extra, tb_info)
            else:
                record = self.logger.makeRecord(self.name, level, fn, lno, msg, args,
                                                exc_info, func, extra)

            if record_filter:
                record = record_filter(record)

            self.logger.handle(record=record)
1015843
def emit(self, record):
        
        should_cb = None
        attr_val = None
        if hasattr(record, self.typestr):
            attr_val = getattr(record, self.typestr)
            should_cb = bool(attr_val)
        if should_cb is None and record.levelno >= logging.INFO:
            should_cb = True
        if hasattr(record, 'tags'):
            for t in record.tags:
                if t in self.tags:
                    if self.tags[t]:
                        should_cb = True
                        continue
                    else:
                        should_cb = False
                        break
        if should_cb:
            self.callback(record, attr_val)
985436
def emit(self, record):
        
        # if we've already processed this record, ignore it
        if record in self._recordQueue:
            return
        
        name = record.name
        lvl = self.loggerLevel(name)
        
        # don't process this log
        if lvl > record.levelno:
            return
        
        self._recordQueue.insert(0, record)
        self._recordQueue = self._recordQueue[:10]
        
        # emit the change
        super(XLogRecordHandler, self).emit(record)
530538
def format(self, record: logging.LogRecord) -> str:
        
        if platform.system() != 'Linux':  # Avoid funny logs on Windows & MacOS
            return super().format(record)

        record.msg = (
            self.STYLE[record.levelname] + record.msg + self.STYLE['END'])
        record.levelname = (
            self.STYLE['LEVEL'] + record.levelname + self.STYLE['END'])
        return super().format(record)
625749
def _get_record(self, record_type):
        """"""
        if not self.has_record_type(record_type):
            raise errors.Unsupported()
        if str(record_type) not in self._records:
            raise errors.Unimplemented()
        return self._records[str(record_type)]
1020462
def format (self, record):
        """"""
        record.hostname = self.hostname
        return logging.Formatter.format(self, record)
1004173
def emit(
            self,
            record):
        

        self.debug_log('emit')

        try:
            record = self.format_record(
                record)
        except Exception as e:
            self.write_log(
                'Exception in Splunk logging handler={}'.format(e))
            self.write_log(
                traceback.format_exc())
            return

        if self.sleep_interval > 0:
            try:
                self.debug_log('put in queue')
                # Put log message into queue; worker thread will pick up
                self.queue.put_nowait(
                    record)
            except Exception as e:
                self.write_log(
                    'log queue full - log data will be dropped.')
        else:
            # Flush log immediately; is blocking call
            self.publish_to_splunk(
                payload=record)
160610
def format(self, record: logging.LogRecord) -> str:
        
        msg: Union[str, dict] = record.msg
        if not isinstance(record.msg, dict):
            msg = {self.default_msg_fieldname: msg}

        if record.exc_info:  # type: ignore
            msg["exc_info"] = record.exc_info
        if record.exc_text:  # type: ignore
            msg["exc_text"] = record.exc_text  # type: ignore

        return self.serializer(msg, default=self._default_handler)