Merge pull request #753 from gin-gonic/bug

fix #752 ignore appengine os.
This commit is contained in:
Javier Provecho Fernandez 2016-12-03 18:45:30 +01:00 committed by GitHub
commit 556287ff08

View File

@ -8,6 +8,7 @@ import (
"fmt"
"io"
"os"
"runtime"
"time"
"golang.org/x/crypto/ssh/terminal"
@ -48,9 +49,12 @@ 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()))
}
}
var skip map[string]struct{}