in auto_sizing/logging/bigquery_log_handler.py [0:0]
def _buffer_to_json(self, buffer):
"""Converts the records in the buffer to JSON."""
return [
{
"timestamp": datetime.datetime.fromtimestamp(record.created).strftime(
"%Y-%m-%d %H:%M:%S"
),
"source": self.source if not hasattr(record, "source") else record.source,
"experiment": None if not hasattr(record, "experiment") else record.experiment,
"metric": None if not hasattr(record, "metric") else record.metric,
"statistic": None if not hasattr(record, "statistic") else record.statistic,
"message": record.getMessage(),
"log_level": record.levelname,
"exception": str(record.exc_info),
"filename": record.filename,
"func_name": record.funcName,
"exception_type": None if not record.exc_info else record.exc_info[0].__name__,
}
for record in buffer
]