

def _get_log_context(self, entity_name):
    context = {
        
    }
    for field in self.get_log_fields():
        if (not hasattr(self, field)):
            continue
        value = getattr(self, field)
        name = '{}_{}'.format(entity_name, field)
        if isinstance(value, uuid.UUID):
            context[name] = value.hex
        elif isinstance(value, LoggableMixin):
            context.update(value._get_log_context(field))
        elif isinstance(value, datetime.date):
            context[name] = value.isoformat()
        elif isinstance(value, decimal.Decimal):
            context[name] = float(value)
        else:
            context[name] = six.text_type(value)
    return context

dataset/ETHPy150Open opennode/nodeconductor/nodeconductor/logging/loggers.py LoggableMixin._get_log_context/original