2019-10-01 21:35:44 -04:00
|
|
|
// +build windows
|
2017-04-17 18:08:24 -04:00
|
|
|
// These files implement ANSI-aware input and output streams for use by the Docker Windows client.
|
|
|
|
// When asked for the set of standard streams (e.g., stdin, stdout, stderr), the code will create
|
|
|
|
// and return pseudo-streams that convert ANSI sequences to / from Windows Console API calls.
|
|
|
|
|
2020-04-16 05:23:37 -04:00
|
|
|
package windowsconsole // import "github.com/moby/term/windows"
|
2017-04-17 18:08:24 -04:00
|
|
|
|
|
|
|
import (
|
|
|
|
"io/ioutil"
|
|
|
|
"os"
|
|
|
|
"sync"
|
|
|
|
|
2019-10-01 21:35:44 -04:00
|
|
|
ansiterm "github.com/Azure/go-ansiterm"
|
2017-08-07 05:52:40 -04:00
|
|
|
"github.com/sirupsen/logrus"
|
2017-04-17 18:08:24 -04:00
|
|
|
)
|
|
|
|
|
|
|
|
var logger *logrus.Logger
|
|
|
|
var initOnce sync.Once
|
|
|
|
|
|
|
|
func initLogger() {
|
|
|
|
initOnce.Do(func() {
|
|
|
|
logFile := ioutil.Discard
|
|
|
|
|
|
|
|
if isDebugEnv := os.Getenv(ansiterm.LogEnv); isDebugEnv == "1" {
|
|
|
|
logFile, _ = os.Create("ansiReaderWriter.log")
|
|
|
|
}
|
|
|
|
|
|
|
|
logger = &logrus.Logger{
|
|
|
|
Out: logFile,
|
|
|
|
Formatter: new(logrus.TextFormatter),
|
|
|
|
Level: logrus.DebugLevel,
|
|
|
|
}
|
|
|
|
})
|
|
|
|
}
|