From d6440ae2499376b7adaa3ae24ccdb10faaa241a2 Mon Sep 17 00:00:00 2001 From: sairoutine Date: Mon, 18 Mar 2019 11:47:46 +0900 Subject: [PATCH] change public property to private --- logger.go | 8 ++++---- logger_test.go | 12 ++++++------ 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/logger.go b/logger.go index f3e407ddae..198a0192d6 100644 --- a/logger.go +++ b/logger.go @@ -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, } diff --git a/logger_test.go b/logger_test.go index 1f6f152704..11a859e6a4 100644 --- a/logger_test.go +++ b/logger_test.go @@ -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