From 20508de5a37e019598a542005e62d5181b4fe07d Mon Sep 17 00:00:00 2001 From: Tobie Morgan Hitchcock Date: Sat, 30 Nov 2019 01:50:29 +0000 Subject: [PATCH] Use JSON logs for SQL queries --- log/stackdriver.go | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/log/stackdriver.go b/log/stackdriver.go index 929df13a..045cd9f2 100644 --- a/log/stackdriver.go +++ b/log/stackdriver.go @@ -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: