func levelIconFormatter()

in packages/cli/internal/pkg/logging/logging.go [43:74]


func levelIconFormatter() zerolog.Formatter {
	return func(i interface{}) string {
		var formatted string
		if ll, ok := i.(string); ok {
			switch ll {
			case "trace":
				formatted = colorize(tracePrefix, gray)
			case "debug":
				formatted = colorize(debugPrefix, gray)
			case "info":
				formatted = colorize(infoPrefix, white)
			case "warn":
				formatted = colorize(warningPrefix, yellow)
			case "error":
				formatted = colorize(errorPrefix, red)
			case "fatal":
				formatted = colorize(fatalPrefix, red)
			case "panic":
				formatted = colorize(panicPrefix, red)
			default:
				formatted = colorize("??", yellow)
			}
		} else {
			if i == nil {
				formatted = colorize("??", yellow)
			} else {
				formatted = fmt.Sprintf("%s", i)
			}
		}
		return formatted
	}
}