1// +build !appengine,!js,windows 2 3package logrus 4 5import ( 6 "io" 7 "os" 8 "syscall" 9) 10 11func checkIfTerminal(w io.Writer) bool { 12 switch v := w.(type) { 13 case *os.File: 14 var mode uint32 15 err := syscall.GetConsoleMode(syscall.Handle(v.Fd()), &mode) 16 return err == nil 17 default: 18 return false 19 } 20} 21