Skip to content

Commit 041ca04

Browse files
Revert "Merge pull request #744 from aviddiviner/logger-fix"
This reverts commit c3bfd69, reversing changes made to 9177f01.
1 parent 7dc96be commit 041ca04

File tree

1 file changed

+2
-13
lines changed

1 file changed

+2
-13
lines changed

logger.go

Lines changed: 2 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,7 @@ package gin
77
import (
88
"fmt"
99
"io"
10-
"os"
1110
"time"
12-
13-
"golang.org/x/crypto/ssh/terminal"
1411
)
1512

1613
var (
@@ -47,11 +44,6 @@ func Logger() HandlerFunc {
4744
// LoggerWithWriter instance a Logger middleware with the specified writter buffer.
4845
// Example: os.Stdout, a file opened in write mode, a socket...
4946
func LoggerWithWriter(out io.Writer, notlogged ...string) HandlerFunc {
50-
isTerm := true
51-
if outFile, ok := out.(*os.File); ok {
52-
isTerm = terminal.IsTerminal(int(outFile.Fd()))
53-
}
54-
5547
var skip map[string]struct{}
5648

5749
if length := len(notlogged); length > 0 {
@@ -79,11 +71,8 @@ func LoggerWithWriter(out io.Writer, notlogged ...string) HandlerFunc {
7971
clientIP := c.ClientIP()
8072
method := c.Request.Method
8173
statusCode := c.Writer.Status()
82-
var statusColor, methodColor string
83-
if isTerm {
84-
statusColor = colorForStatus(statusCode)
85-
methodColor = colorForMethod(method)
86-
}
74+
statusColor := colorForStatus(statusCode)
75+
methodColor := colorForMethod(method)
8776
comment := c.Errors.ByType(ErrorTypePrivate).String()
8877

8978
fmt.Fprintf(out, "[GIN] %v |%s %3d %s| %13v | %s |%s %s %-7s %s\n%s",

0 commit comments

Comments
 (0)