diff --git a/go.mod b/go.mod index 408d8c41..5e7bdbe5 100644 --- a/go.mod +++ b/go.mod @@ -15,7 +15,7 @@ require ( github.com/hako/durafmt v0.0.0-20210608085754-5c1018a4e16b github.com/hashicorp/go-multierror v1.1.1 github.com/hashicorp/golang-lru v1.0.2 - github.com/mattn/go-colorable v0.1.13 // indirect + github.com/mattn/go-colorable v0.1.13 github.com/mgutz/ansi v0.0.0-20200706080929-d51e80ef957d // indirect github.com/miekg/dns v1.1.56 github.com/mroth/weightedrand/v2 v2.1.0 diff --git a/log/logger.go b/log/logger.go index ad98db3f..b685eb52 100644 --- a/log/logger.go +++ b/log/logger.go @@ -8,6 +8,7 @@ import ( "strings" "sync" + "github.com/mattn/go-colorable" "github.com/sirupsen/logrus" prefixed "github.com/x-cray/logrus-prefixed-formatter" "golang.org/x/exp/maps" @@ -111,6 +112,9 @@ func ConfigureLogger(cfg *Config) { logger.SetFormatter(logFormatter) + // Windows does not support ANSI colors + logger.SetOutput(colorable.NewColorableStdout()) + case FormatTypeJson: logger.SetFormatter(&logrus.JSONFormatter{}) } diff --git a/server/server_config_trigger_windows.go b/server/server_config_trigger_windows.go index 4bcf7695..73ed7fbc 100644 --- a/server/server_config_trigger_windows.go +++ b/server/server_config_trigger_windows.go @@ -1,4 +1,6 @@ package server -func registerPrintConfigurationTrigger(s *Server) { +import "context" + +func registerPrintConfigurationTrigger(ctx context.Context, s *Server) { }