mirror of
https://github.com/gin-gonic/gin.git
synced 2025-10-22 09:34:33 +08:00
Add response size to LogFormatterParams
This commit is contained in:
parent
d27685e714
commit
45bf02c00e
@ -63,6 +63,8 @@ type LogFormatterParams struct {
|
||||
ErrorMessage string
|
||||
// IsTerm shows whether does gin's output descriptor refers to a terminal.
|
||||
IsTerm bool
|
||||
// BodySize is the size of the Response Body
|
||||
BodySize int
|
||||
}
|
||||
|
||||
// defaultLogFormatter is the default log format function Logger middleware uses.
|
||||
@ -185,6 +187,8 @@ func LoggerWithConfig(conf LoggerConfig) HandlerFunc {
|
||||
param.StatusCode = c.Writer.Status()
|
||||
param.ErrorMessage = c.Errors.ByType(ErrorTypePrivate).String()
|
||||
|
||||
param.BodySize = c.Writer.Size()
|
||||
|
||||
if raw != "" {
|
||||
path = path + "?" + raw
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user