mirror of https://github.com/gin-gonic/gin.git
Merge pull request #754 from gin-gonic/patch-13
Support google appengine for IsTerminal func.
This commit is contained in:
commit
18392f589f
|
@ -2,9 +2,9 @@ language: go
|
||||||
sudo: false
|
sudo: false
|
||||||
go:
|
go:
|
||||||
- 1.4
|
- 1.4
|
||||||
- 1.5
|
- 1.5.4
|
||||||
- 1.6
|
- 1.6.4
|
||||||
- 1.7
|
- 1.7.4
|
||||||
- tip
|
- tip
|
||||||
|
|
||||||
script:
|
script:
|
||||||
|
|
|
@ -8,10 +8,9 @@ import (
|
||||||
"fmt"
|
"fmt"
|
||||||
"io"
|
"io"
|
||||||
"os"
|
"os"
|
||||||
"runtime"
|
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
"golang.org/x/crypto/ssh/terminal"
|
"github.com/mattn/go-isatty"
|
||||||
)
|
)
|
||||||
|
|
||||||
var (
|
var (
|
||||||
|
@ -50,10 +49,8 @@ func Logger() HandlerFunc {
|
||||||
func LoggerWithWriter(out io.Writer, notlogged ...string) HandlerFunc {
|
func LoggerWithWriter(out io.Writer, notlogged ...string) HandlerFunc {
|
||||||
isTerm := true
|
isTerm := true
|
||||||
|
|
||||||
if runtime.GOOS != "appengine" && runtime.GOOS != "netbsd" && runtime.GOOS != "openbsd" {
|
if w, ok := out.(*os.File); !ok || !isatty.IsTerminal(w.Fd()) {
|
||||||
if outFile, ok := out.(*os.File); ok {
|
isTerm = false
|
||||||
isTerm = terminal.IsTerminal(int(outFile.Fd()))
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
var skip map[string]struct{}
|
var skip map[string]struct{}
|
||||||
|
|
Loading…
Reference in New Issue