mirror of
https://github.com/gin-gonic/gin.git
synced 2025-10-21 16:58:08 +08:00
change public property to private
This commit is contained in:
parent
bdd6c78d5b
commit
d6440ae249
@ -69,8 +69,8 @@ type LogFormatterParams struct {
|
||||
Path string
|
||||
// ErrorMessage is set if error has occurred in processing the request.
|
||||
ErrorMessage string
|
||||
// IsTerm shows whether does gin's output descriptor refers to a terminal.
|
||||
IsTerm bool
|
||||
// isTerm shows whether does gin's output descriptor refers to a terminal.
|
||||
isTerm bool
|
||||
// BodySize is the size of the Response Body
|
||||
BodySize int
|
||||
// Keys are the keys set on the request's context.
|
||||
@ -124,7 +124,7 @@ func (p *LogFormatterParams) ResetColor() string {
|
||||
|
||||
// IsOutputColor indicates whether can colors be outputted to the log.
|
||||
func (p *LogFormatterParams) IsOutputColor() bool {
|
||||
return consoleColorMode == forceColor || (consoleColorMode == autoColor && p.IsTerm)
|
||||
return consoleColorMode == forceColor || (consoleColorMode == autoColor && p.isTerm)
|
||||
}
|
||||
|
||||
// defaultLogFormatter is the default log format function Logger middleware uses.
|
||||
@ -239,7 +239,7 @@ func LoggerWithConfig(conf LoggerConfig) HandlerFunc {
|
||||
if _, ok := skip[path]; !ok {
|
||||
param := LogFormatterParams{
|
||||
Request: c.Request,
|
||||
IsTerm: isTerm,
|
||||
isTerm: isTerm,
|
||||
Keys: c.Keys,
|
||||
}
|
||||
|
||||
|
@ -240,7 +240,7 @@ func TestDefaultLogFormatter(t *testing.T) {
|
||||
Method: "GET",
|
||||
Path: "/",
|
||||
ErrorMessage: "",
|
||||
IsTerm: false,
|
||||
isTerm: false,
|
||||
}
|
||||
|
||||
termTrueParam := LogFormatterParams{
|
||||
@ -251,7 +251,7 @@ func TestDefaultLogFormatter(t *testing.T) {
|
||||
Method: "GET",
|
||||
Path: "/",
|
||||
ErrorMessage: "",
|
||||
IsTerm: true,
|
||||
isTerm: true,
|
||||
}
|
||||
|
||||
assert.Equal(t, "[GIN] 2018/12/07 - 09:11:42 | 200 | 5s | 20.20.20.20 | GET /\n", defaultLogFormatter(termFalseParam))
|
||||
@ -297,9 +297,9 @@ func TestResetColor(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestIsOutputColor(t *testing.T) {
|
||||
// test with IsTerm flag true.
|
||||
// test with isTerm flag true.
|
||||
p := LogFormatterParams{
|
||||
IsTerm: true,
|
||||
isTerm: true,
|
||||
}
|
||||
|
||||
consoleColorMode = autoColor
|
||||
@ -311,9 +311,9 @@ func TestIsOutputColor(t *testing.T) {
|
||||
DisableConsoleColor()
|
||||
assert.Equal(t, false, p.IsOutputColor())
|
||||
|
||||
// test with IsTerm flag false.
|
||||
// test with isTerm flag false.
|
||||
p = LogFormatterParams{
|
||||
IsTerm: false,
|
||||
isTerm: false,
|
||||
}
|
||||
|
||||
consoleColorMode = autoColor
|
||||
|
Loading…
x
Reference in New Issue
Block a user