Skip to content
Myr

Merge pull request #754 from gin-gonic/patch-13

Before adoption: this commit came in with the history the project adopted, so no landing records it.

Support google appengine for IsTerminal func.

authored by Bo-Yi Wu · committed by GitHub · parents 0f80d5d, 83e2ea2 · Browse files · 2 files+6 added−9 removed
This commit

State

Before adoption: this commit came in with the history the project adopted, so no landing records it.

Diff stats

2 files+6 added−9 removed

  • other:+6 added−9 removed

2 files+6 added−9 removed

modified:.travis.yml+3 added-3 removed
modified:logger.go+3 added-6 removed
6 unmodified lines
7import (8 "fmt"9 "io"10 "os"11 "runtime"11 "time"1214 "golang.org/x/crypto/ssh/terminal"13 "github.com/mattn/go-isatty"14)1516var (17 green = string([]byte{27, 91, 57, 55, 59, 52, 50, 109})
30 unmodified lines
48// Example: os.Stdout, a file opened in write mode, a socket...49func LoggerWithWriter(out io.Writer, notlogged ...string) HandlerFunc {50 isTerm := true5153 if runtime.GOOS != "appengine" && runtime.GOOS != "netbsd" && runtime.GOOS != "openbsd" {54 if outFile, ok := out.(*os.File); ok {55 isTerm = terminal.IsTerminal(int(outFile.Fd()))56 }52 if w, ok := out.(*os.File); !ok || !isatty.IsTerminal(w.Fd()) {53 isTerm = false54 }5556 var skip map[string]struct{}57
78 unmodified lines