Configure logging level and format

This commit is contained in:
Dan Sosedoff
2022-12-06 12:09:21 -06:00
parent 3e1a93296e
commit dbd3b26f6c
3 changed files with 36 additions and 3 deletions

View File

@@ -55,6 +55,7 @@ func RequestLogger(logger *logrus.Logger) gin.HandlerFunc {
"method": c.Request.Method,
"remote_addr": c.ClientIP(),
"duration": latency,
"path": path,
}
if err := c.Errors.Last(); err != nil {
@@ -66,7 +67,7 @@ func RequestLogger(logger *logrus.Logger) gin.HandlerFunc {
fields["raw_query"] = c.Request.URL.RawQuery
}
entry := logrus.WithFields(fields)
entry := logger.WithFields(fields)
msg := "http_request " + path
switch {