diff --git a/go.mod b/go.mod index e33228cd..3d72c5db 100644 --- a/go.mod +++ b/go.mod @@ -12,6 +12,7 @@ require ( github.com/google/uuid v1.6.0 github.com/jackc/pgx/v5 v5.5.4 github.com/lmittmann/tint v1.0.4 + github.com/mattn/go-isatty v0.0.20 github.com/samber/slog-multi v1.0.2 github.com/samber/slog-sentry/v2 v2.4.0 github.com/segmentio/kafka-go v0.4.39 diff --git a/go.sum b/go.sum index e57f989e..fb6af46e 100644 --- a/go.sum +++ b/go.sum @@ -374,6 +374,8 @@ github.com/lmittmann/tint v1.0.4 h1:LeYihpJ9hyGvE0w+K2okPTGUdVLfng1+nDNVR4vWISc= github.com/lmittmann/tint v1.0.4/go.mod h1:HIS3gSy7qNwGCj+5oRjAutErFBl4BzdQP6cJZ0NfMwE= github.com/lunixbochs/vtclean v1.0.0/go.mod h1:pHhQNgMf3btfWnGBVipUOjRYhoOsdGqdm/+2c2E2WMI= github.com/mailru/easyjson v0.0.0-20190312143242-1de009706dbe/go.mod h1:C1wdFJiN94OJF2b5HbByQZoLdCWB1Yqtg26g4irojpc= +github.com/mattn/go-isatty v0.0.20 h1:xfD0iDuEKnDkl03q4limB+vH+GxLEtL/jb4xVJSWWEY= +github.com/mattn/go-isatty v0.0.20/go.mod h1:W+V8PltTTMOvKvAeJH7IuucS94S2C6jfK/D7dTCTo3Y= github.com/matttproud/golang_protobuf_extensions v1.0.1/go.mod h1:D8He9yQNgCq6Z5Ld7szi9bcBfOoFv/3dc6xSMkL2PC0= github.com/microcosm-cc/bluemonday v1.0.1/go.mod h1:hsXNsILzKxV+sX77C5b8FSuKF00vh2OMYv+xgHpAMF4= github.com/microsoft/go-mssqldb v1.7.0 h1:sgMPW0HA6Ihd37Yx0MzHyKD726C2kY/8KJsQtXHNaAs= @@ -666,6 +668,7 @@ golang.org/x/sys v0.0.0-20220715151400-c0bba94af5f8/go.mod h1:oPkhp1MJrh7nUepCBc golang.org/x/sys v0.0.0-20220722155257-8c9f86f7a55f/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.1.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.5.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.8.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.17.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= golang.org/x/sys v0.18.0 h1:DBdB3niSjOA/O0blCZBqDefyWNYveAYMNF1Wum0DYQ4= diff --git a/integration_tests/mysql/main.go b/integration_tests/mysql/main.go index 873fd331..55c40f14 100644 --- a/integration_tests/mysql/main.go +++ b/integration_tests/mysql/main.go @@ -10,6 +10,7 @@ import ( "os" "github.com/lmittmann/tint" + "github.com/mattn/go-isatty" "github.com/artie-labs/reader/config" "github.com/artie-labs/reader/integration_tests/utils" @@ -23,7 +24,10 @@ func main() { if err := os.Setenv("TZ", "UTC"); err != nil { logger.Fatal("Unable to set TZ env var: %w", err) } - slog.SetDefault(slog.New(tint.NewHandler(os.Stderr, &tint.Options{Level: slog.LevelInfo}))) + slog.SetDefault(slog.New(tint.NewHandler(os.Stderr, &tint.Options{ + Level: slog.LevelInfo, + NoColor: !isatty.IsTerminal(os.Stderr.Fd()), + }))) var mysqlHost string = os.Getenv("MYSQL_HOST") if mysqlHost == "" {