func initLogger()

in ci/internal/cli/mitresync.go [251:277]


func initLogger(stdout io.Writer, f *mitreSyncFlags) {
	opts := &tint.Options{
		Level:      slog.LevelInfo,
		TimeFormat: time.TimeOnly,
	}
	if f.debug {
		opts.Level = slog.LevelDebug
	}

	// Disable colors and stabilize time values with zero values if testing.
	if _, ok := os.LookupEnv("TEST_MITRESYNC"); ok {
		opts.NoColor = true
		opts.ReplaceAttr = func(groups []string, attr slog.Attr) slog.Attr {
			switch attr.Value.Any().(type) {
			case time.Time:
				return slog.Time(attr.Key, time.Time{})
			case time.Duration:
				return slog.Duration(attr.Key, time.Duration(0))
			default:
				return attr
			}
		}
	}

	logger := slog.New(tint.NewHandler(stdout, opts))
	slog.SetDefault(logger)
}