Skip to content

Commit

Permalink
Merge pull request #754 from gin-gonic/patch-13
Browse files Browse the repository at this point in the history
Support google appengine for IsTerminal func.
  • Loading branch information
appleboy authored Dec 4, 2016
2 parents 0f80d5d + 83e2ea2 commit 18392f5
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 9 deletions.
6 changes: 3 additions & 3 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@ language: go
sudo: false
go:
- 1.4
- 1.5
- 1.6
- 1.7
- 1.5.4
- 1.6.4
- 1.7.4
- tip

script:
Expand Down
9 changes: 3 additions & 6 deletions logger.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,9 @@ import (
"fmt"
"io"
"os"
"runtime"
"time"

"golang.org/x/crypto/ssh/terminal"
"github.com/mattn/go-isatty"
)

var (
Expand Down Expand Up @@ -50,10 +49,8 @@ func Logger() HandlerFunc {
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 w, ok := out.(*os.File); !ok || !isatty.IsTerminal(w.Fd()) {
isTerm = false
}

var skip map[string]struct{}
Expand Down

0 comments on commit 18392f5

Please sign in to comment.