github.com/endophage/docker@v1.4.2-0.20161027011718-242853499895/pkg/term/windows/windows.go (about)

     1  // These files implement ANSI-aware input and output streams for use by the Docker Windows client.
     2  // When asked for the set of standard streams (e.g., stdin, stdout, stderr), the code will create
     3  // and return pseudo-streams that convert ANSI sequences to / from Windows Console API calls.
     4  
     5  package windows
     6  
     7  import (
     8  	"io/ioutil"
     9  	"os"
    10  	"sync"
    11  
    12  	ansiterm "github.com/Azure/go-ansiterm"
    13  	"github.com/Sirupsen/logrus"
    14  )
    15  
    16  var logger *logrus.Logger
    17  var initOnce sync.Once
    18  
    19  func initLogger() {
    20  	initOnce.Do(func() {
    21  		logFile := ioutil.Discard
    22  
    23  		if isDebugEnv := os.Getenv(ansiterm.LogEnv); isDebugEnv == "1" {
    24  			logFile, _ = os.Create("ansiReaderWriter.log")
    25  		}
    26  
    27  		logger = &logrus.Logger{
    28  			Out:       logFile,
    29  			Formatter: new(logrus.TextFormatter),
    30  			Level:     logrus.DebugLevel,
    31  		}
    32  	})
    33  }