def format(self, record):
super(SqlFormatter, self).format(record)
sql = record.sql.strip()
if self.parse:
sql = sqlparse.format(sql, reindent=self.reindent, keyword_case=self.keyword_case)
if hasattr(record, 'duration'):
sql = "({0:.3f}ms) {1}".format(record.duration, sql)
if self.highlight:
sql = highlight(
sql,
self._lexer,
self._formatter
)
return sql
评论列表
文章目录