Add comment to LogFormatterParams struct's fields (#1711)

By https://github.com/gin-gonic/gin/issues/1701, I thought it's necessary.
This commit is contained in:
Sai 2018-12-26 00:27:24 +09:00 committed by Bo-Yi Wu
parent 678e09c736
commit 2d33c82028
1 changed files with 17 additions and 8 deletions

View File

@ -46,13 +46,22 @@ type LogFormatter func(params LogFormatterParams) string
// LogFormatterParams is the structure any formatter will be handed when time to log comes // LogFormatterParams is the structure any formatter will be handed when time to log comes
type LogFormatterParams struct { type LogFormatterParams struct {
Request *http.Request Request *http.Request
// TimeStamp shows the time after the server returns a response.
TimeStamp time.Time TimeStamp time.Time
// StatusCode is HTTP response code.
StatusCode int StatusCode int
// Latency is how much time the server cost to process a certain request.
Latency time.Duration Latency time.Duration
// ClientIP equals Context's ClientIP method.
ClientIP string ClientIP string
// Method is the HTTP method given to the request.
Method string Method string
// Path is a path the client requests.
Path string Path string
// ErrorMessage is set if error has occurred in processing the request.
ErrorMessage string ErrorMessage string
// IsTerm shows whether does gin's output descriptor refers to a terminal.
IsTerm bool IsTerm bool
} }