Use JSON logs for SQL queries
This commit is contained in:
parent
a675790fef
commit
20508de5a3
1 changed files with 7 additions and 0 deletions
|
@ -106,6 +106,13 @@ func (h *StackdriverLogger) Fire(entry *logrus.Entry) error {
|
||||||
Severity: logging.ParseSeverity(entry.Level.String()),
|
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 {
|
for k, v := range entry.Data {
|
||||||
switch i := v.(type) {
|
switch i := v.(type) {
|
||||||
default:
|
default:
|
||||||
|
|
Loading…
Reference in a new issue