...

Source file src/github.com/sirupsen/logrus/terminal_check_windows.go

Documentation: github.com/sirupsen/logrus

     1  // +build !appengine,!js,windows
     2  
     3  package logrus
     4  
     5  import (
     6  	"io"
     7  	"os"
     8  	"syscall"
     9  )
    10  
    11  func 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  

View as plain text