make context.Keys available as LogFormatterParams (#1779)

* make context available as LogFormatterParams

* pass context Keys to LogFormatterParams

* update logger test to check for Key param
This commit is contained in:
Adam Zielinski
2019-03-06 20:47:31 -05:00
committed by 田欧
parent 057f63b1bb
commit 3dc247893e
2 changed files with 7 additions and 0 deletions
+3
View File
@@ -66,6 +66,8 @@ type LogFormatterParams struct {
IsTerm bool
// BodySize is the size of the Response Body
BodySize int
// Keys are the keys set on the request's context.
Keys map[string]interface{}
}
// StatusCodeColor is the ANSI color for appropriately logging http status code to a terminal.
@@ -227,6 +229,7 @@ func LoggerWithConfig(conf LoggerConfig) HandlerFunc {
param := LogFormatterParams{
Request: c.Request,
IsTerm: isTerm,
Keys: c.Keys,
}
// Stop timer