Source code for qualia_core.utils.logger.CSVFormatter
import io
import csv
import logging
[docs]
class CSVFormatter(logging.Formatter):
def __init__(self):
super().__init__()
self.output = io.StringIO()
self.writer = csv.writer(self.output)
[docs]
def format(self, record):
self.writer.writerow(record.msg)
data = self.output.getvalue()
self.output.truncate(0)
self.output.seek(0)
return data.strip()