Use JSON logs for SQL queries

This commit is contained in:
Tobie Morgan Hitchcock 2019-11-30 01:50:29 +00:00
parent a675790fef
commit 20508de5a3

View file

@ -106,6 +106,13 @@ func (h *StackdriverLogger) Fire(entry *logrus.Entry) error {
Severity: logging.ParseSeverity(entry.Level.String()),
}
if p, ok := entry.Data["prefix"]; ok && p == "sql" {
e.Payload = map[string]interface{}{
"sql": entry.Message,
"vars": entry.Data["vars"],
}
}
for k, v := range entry.Data {
switch i := v.(type) {
default: