Skip to content

Commit

Permalink
change public property to private
Browse files Browse the repository at this point in the history
  • Loading branch information
sairoutine committed Mar 18, 2019
1 parent bdd6c78 commit d6440ae
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 10 deletions.
8 changes: 4 additions & 4 deletions logger.go
Expand Up @@ -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.
Expand Down Expand Up @@ -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.
Expand Down Expand Up @@ -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,
}

Expand Down
12 changes: 6 additions & 6 deletions logger_test.go
Expand Up @@ -240,7 +240,7 @@ func TestDefaultLogFormatter(t *testing.T) {
Method: "GET",
Path: "/",
ErrorMessage: "",
IsTerm: false,
isTerm: false,
}

termTrueParam := LogFormatterParams{
Expand All @@ -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))
Expand Down Expand Up @@ -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
Expand All @@ -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
Expand Down

0 comments on commit d6440ae

Please sign in to comment.