From 63b5d1c4c885a0cf257b5977e4f019e9f9458137 Mon Sep 17 00:00:00 2001 From: Javier Provecho Fernandez Date: Sat, 3 Dec 2016 22:04:35 +0100 Subject: [PATCH 1/3] Revert "Merge pull request #753 from gin-gonic/bug" This reverts commit 556287ff0856a5ad1f9a1b493c188cabeceba929, reversing changes made to 32cab500ecc71d2975f5699c8a65c6debb29cfbe. --- logger.go | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/logger.go b/logger.go index ad442d0c..b4743a7f 100644 --- a/logger.go +++ b/logger.go @@ -8,7 +8,6 @@ import ( "fmt" "io" "os" - "runtime" "time" "golang.org/x/crypto/ssh/terminal" @@ -49,11 +48,8 @@ func Logger() HandlerFunc { // Example: os.Stdout, a file opened in write mode, a socket... func LoggerWithWriter(out io.Writer, notlogged ...string) HandlerFunc { isTerm := true - - if runtime.GOOS != "appengine" && runtime.GOOS != "netbsd" && runtime.GOOS != "openbsd" { - if outFile, ok := out.(*os.File); ok { - isTerm = terminal.IsTerminal(int(outFile.Fd())) - } + if outFile, ok := out.(*os.File); ok { + isTerm = terminal.IsTerminal(int(outFile.Fd())) } var skip map[string]struct{} From 041ca04a4768ededad44dcc2748f3d47e4b59bde Mon Sep 17 00:00:00 2001 From: Javier Provecho Fernandez Date: Sat, 3 Dec 2016 22:10:08 +0100 Subject: [PATCH 2/3] Revert "Merge pull request #744 from aviddiviner/logger-fix" This reverts commit c3bfd69303d0fdaf2d43a7ff07cc8ee45ec7bb3f, reversing changes made to 9177f01c2843b91820780197f521ba48554b9df3. --- logger.go | 15 ++------------- 1 file changed, 2 insertions(+), 13 deletions(-) diff --git a/logger.go b/logger.go index b4743a7f..d56bc628 100644 --- a/logger.go +++ b/logger.go @@ -7,10 +7,7 @@ package gin import ( "fmt" "io" - "os" "time" - - "golang.org/x/crypto/ssh/terminal" ) var ( @@ -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 { @@ -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", From 9fd7534b54a04bccbf9c61e6fbb2f4598b05142e Mon Sep 17 00:00:00 2001 From: Rohan Pai Date: Wed, 1 Mar 2017 12:48:45 -0800 Subject: [PATCH 3/3] Added Sourcegraph badge --- README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/README.md b/README.md index 82ea6a58..2279a59b 100644 --- a/README.md +++ b/README.md @@ -7,6 +7,7 @@ [![Go Report Card](https://goreportcard.com/badge/github.com/gin-gonic/gin)](https://goreportcard.com/report/github.com/gin-gonic/gin) [![GoDoc](https://godoc.org/github.com/gin-gonic/gin?status.svg)](https://godoc.org/github.com/gin-gonic/gin) [![Join the chat at https://gitter.im/gin-gonic/gin](https://badges.gitter.im/Join%20Chat.svg)](https://gitter.im/gin-gonic/gin?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge) +[![Sourcegraph Badge](https://sourcegraph.com/github.com/gin-gonic/gin/-/badge.svg)](https://sourcegraph.com/github.com/gin-gonic/gin?badge) Gin is a web framework written in Go (Golang). It features a martini-like API with much better performance, up to 40 times faster thanks to [httprouter](https://github.com/julienschmidt/httprouter). If you need performance and good productivity, you will love Gin.