Skip to content

Commit

Permalink
Revert "Merge pull request #744 from aviddiviner/logger-fix"
Browse files Browse the repository at this point in the history
This reverts commit c3bfd69, reversing
changes made to 9177f01.
  • Loading branch information
javierprovecho committed Dec 3, 2016
1 parent 7dc96be commit 041ca04
Showing 1 changed file with 2 additions and 13 deletions.
15 changes: 2 additions & 13 deletions logger.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,7 @@ package gin
import (
"fmt"
"io"
"os"
"time"

"golang.org/x/crypto/ssh/terminal"
)

var (
Expand Down Expand Up @@ -47,11 +44,6 @@ func Logger() HandlerFunc {
// LoggerWithWriter instance a Logger middleware with the specified writter buffer.
// Example: os.Stdout, a file opened in write mode, a socket...
func LoggerWithWriter(out io.Writer, notlogged ...string) HandlerFunc {
isTerm := true
if outFile, ok := out.(*os.File); ok {
isTerm = terminal.IsTerminal(int(outFile.Fd()))
}

var skip map[string]struct{}

if length := len(notlogged); length > 0 {
Expand Down Expand Up @@ -79,11 +71,8 @@ func LoggerWithWriter(out io.Writer, notlogged ...string) HandlerFunc {
clientIP := c.ClientIP()
method := c.Request.Method
statusCode := c.Writer.Status()
var statusColor, methodColor string
if isTerm {
statusColor = colorForStatus(statusCode)
methodColor = colorForMethod(method)
}
statusColor := colorForStatus(statusCode)
methodColor := colorForMethod(method)
comment := c.Errors.ByType(ErrorTypePrivate).String()

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

0 comments on commit 041ca04

Please sign in to comment.