🎨 Lowercase key names in logfmt

This commit is contained in:
Maxim Lebedev 2022-01-07 03:50:09 +05:00
parent aa710c0887
commit 4420ad2609
Signed by: toby3d
GPG Key ID: 1F14E25B7C119FC5
1 changed files with 3 additions and 3 deletions

View File

@ -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)
}
}