Exemplo n.º 1
0
    def _fix_attribute_names(self, record: logging.LogRecord):
        """Transform record field names from camel case to underscored."""
        for attribute, transform in self.RECORD_ATTRIBUTE_TRANSFORM:
            value = record.__getattribute__(attribute)
            record.__setattr__(transform, value)

        return record
 def filter(self, record: logging.LogRecord):
     if self._content:
         for attr in self._content:
             if not hasattr(record, attr):
                 record.__setattr__(attr, self._content.get(attr))
             else:
                 logger.warning(
                     f"Appender key {attr} found in line! Not adding")
                 continue
     return True