1
0
Fork 0

Colored logs on windows.

This commit is contained in:
Ludovic Fernandez 2018-10-02 16:28:04 +02:00 committed by Traefiker Bot
parent f04813fa02
commit 4cb1ae4626
17 changed files with 427 additions and 121 deletions

View file

@ -0,0 +1,20 @@
// +build !appengine,!js,windows
package logrus
import (
"io"
"os"
"syscall"
)
func checkIfTerminal(w io.Writer) bool {
switch v := w.(type) {
case *os.File:
var mode uint32
err := syscall.GetConsoleMode(syscall.Handle(v.Fd()), &mode)
return err == nil
default:
return false
}
}