diff options
author | Wim <wim@42.be> | 2018-02-21 00:48:10 +0100 |
---|---|---|
committer | Wim <wim@42.be> | 2018-02-21 00:48:10 +0100 |
commit | 55ab0c12f12e2f0ee15dccd519e1fca4d011b73b (patch) | |
tree | 8d114d1129424e446a0124b9520d2ff3b2175369 /vendor/github.com/labstack/echo/middleware/logger.go | |
parent | d1227b5fc9de9f7a04fbf71292dd224aa8806411 (diff) | |
download | matterbridge-msglm-55ab0c12f12e2f0ee15dccd519e1fca4d011b73b.tar.gz matterbridge-msglm-55ab0c12f12e2f0ee15dccd519e1fca4d011b73b.tar.bz2 matterbridge-msglm-55ab0c12f12e2f0ee15dccd519e1fca4d011b73b.zip |
Update vendor labstack/echo
Diffstat (limited to 'vendor/github.com/labstack/echo/middleware/logger.go')
-rw-r--r-- | vendor/github.com/labstack/echo/middleware/logger.go | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/vendor/github.com/labstack/echo/middleware/logger.go b/vendor/github.com/labstack/echo/middleware/logger.go index b9c54468..c7b80f8c 100644 --- a/vendor/github.com/labstack/echo/middleware/logger.go +++ b/vendor/github.com/labstack/echo/middleware/logger.go @@ -26,6 +26,7 @@ type ( // - time_unix_nano // - time_rfc3339 // - time_rfc3339_nano + // - time_custom // - id (Request ID) // - remote_ip // - uri @@ -46,7 +47,10 @@ type ( // Example "${remote_ip} ${status}" // // Optional. Default value DefaultLoggerConfig.Format. - Format string `json:"format"` + Format string `yaml:"format"` + + // Optional. Default value DefaultLoggerConfig.CustomTimeFormat. + CustomTimeFormat string `yaml:"custom_time_format"` // Output is a writer where logs in JSON format are written. // Optional. Default value os.Stdout. @@ -66,6 +70,7 @@ var ( `"method":"${method}","uri":"${uri}","status":${status}, "latency":${latency},` + `"latency_human":"${latency_human}","bytes_in":${bytes_in},` + `"bytes_out":${bytes_out}}` + "\n", + CustomTimeFormat:"2006-01-02 15:04:05.00000", Output: os.Stdout, colorer: color.New(), } @@ -126,6 +131,8 @@ func LoggerWithConfig(config LoggerConfig) echo.MiddlewareFunc { return buf.WriteString(time.Now().Format(time.RFC3339)) case "time_rfc3339_nano": return buf.WriteString(time.Now().Format(time.RFC3339Nano)) + case "time_custom": + return buf.WriteString(time.Now().Format(config.CustomTimeFormat)) case "id": id := req.Header.Get(echo.HeaderXRequestID) if id == "" { |