Closed mpiorowski closed 3 months ago
That's my current setup:
func InitLogger() {
var level log.Level
if LOG_LEVEL == "info" {
level = log.InfoLevel
} else {
level = log.DebugLevel
}
logger := log.NewWithOptions(os.Stderr, log.Options{
ReportCaller: true,
ReportTimestamp: true,
TimeFormat: time.Kitchen,
Level: level,
})
slog.SetDefault(slog.New(logger))
}
How are you running your image? You need to use docker run -it <image>
for an interactive TTY container.
@aymanbagabas I run the docker compose with -it:
Still not working:
What's your $TERM
inside the docker? Usually it defaults to TERM=xterm
which indicates no colors. Try docker run -e TERM=xterm-256color -e COLORTERM=truecolor -it <image>
Yep, tty: true + this setup helped :)
thanks!
Describe the bug No color outputs in when running go app in docker compose