change tty detection library to what syncthing uses

This commit is contained in:
Jeffrey Paul 2019-11-06 08:02:55 -08:00
parent a854a48b2b
commit 86db12d02d

View File

@ -8,7 +8,7 @@ import _ "github.com/jinzhu/gorm/dialects/sqlite"
import "github.com/rs/zerolog" import "github.com/rs/zerolog"
import "github.com/rs/zerolog/log" import "github.com/rs/zerolog/log"
import "golang.org/x/crypto/ssh/terminal" import "github.com/mattn/go-isatty"
type InstanceHostname string type InstanceHostname string
@ -48,7 +48,9 @@ func (f *FetaProcess) setupLogging() {
log.Logger = log.With().Caller().Logger() log.Logger = log.With().Caller().Logger()
if terminal.IsTerminal(int(os.Stdout.Fd())) { tty := isatty.IsTerminal(os.Stdin.Fd()) || isatty.IsCygwinTerminal(os.Stdin.Fd())
if tty {
out := zerolog.NewConsoleWriter( out := zerolog.NewConsoleWriter(
func(w *zerolog.ConsoleWriter) { func(w *zerolog.ConsoleWriter) {
// Customize time format // Customize time format