From 38e4b1d2fe5b0890dd2f72def7d5852b4a25984f Mon Sep 17 00:00:00 2001 From: Bo-Yi Wu Date: Sun, 4 Dec 2016 09:50:02 +0800 Subject: [PATCH] Support google appengine for IsTerminal func. Signed-off-by: Bo-Yi Wu --- logger.go | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/logger.go b/logger.go index ad442d0..7c2a72b 100644 --- a/logger.go +++ b/logger.go @@ -8,10 +8,9 @@ import ( "fmt" "io" "os" - "runtime" "time" - "golang.org/x/crypto/ssh/terminal" + "github.com/mattn/go-isatty" ) var ( @@ -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{}