log/terminal.go

19 lines
365 B
Go
Raw Normal View History

2020-04-13 00:12:48 +00:00
// +build !js,!wasm
package log
import (
"os"
"golang.org/x/crypto/ssh/terminal"
)
// Terminal module determines if an interactive shell is in use. If
// not interactive, disable colors by default. This is so deployed web apps
// log their output in plain text.
var interactive = false
func init() {
interactive = terminal.IsTerminal(int(os.Stdout.Fd()))
}