🎨 Lowercase key names in logfmt

master v0.6.2
Maxim Lebedev 11 months ago
parent aa710c0887
commit 4420ad2609
Signed by: toby3d
GPG Key ID: 1F14E25B7C119FC5
  1. 6
      logfmt.go

@ -68,15 +68,15 @@ func LogFmtWithConfig(config LogFmtConfig) Interceptor {
"user_agent", ctx.UserAgent(),
)
ctx.Request.Header.VisitAllInOrder(func(key, value []byte) {
encoder.EncodeKeyval(strings.ReplaceAll("header_"+string(key), "-", "_"), value)
encoder.EncodeKeyval(strings.ReplaceAll(strings.ToLower("header_"+string(key)), "-", "_"), value)
})
ctx.QueryArgs().VisitAll(func(key, value []byte) {
encoder.EncodeKeyval(strings.ReplaceAll("query_"+string(key), "-", "_"), value)
encoder.EncodeKeyval(strings.ReplaceAll(strings.ToLower("query_"+string(key)), "-", "_"), value)
})
if form, err := ctx.MultipartForm(); err == nil {
for k, v := range form.Value {
encoder.EncodeKeyval(strings.ReplaceAll("form_"+k, "-", "_"), v)
encoder.EncodeKeyval(strings.ReplaceAll(strings.ToLower("form_"+k), "-", "_"), v)
}
}

Loading…
Cancel
Save