From 53efc5e18cfa1c4b94400e2bea86710dfb177ea2 Mon Sep 17 00:00:00 2001 From: Daylin Morgan Date: Fri, 21 Jun 2024 09:51:05 -0500 Subject: [PATCH] change log colors --- pkgs/oizys/oizys-go/cmd/root.go | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/pkgs/oizys/oizys-go/cmd/root.go b/pkgs/oizys/oizys-go/cmd/root.go index e447773..26b1196 100644 --- a/pkgs/oizys/oizys-go/cmd/root.go +++ b/pkgs/oizys/oizys-go/cmd/root.go @@ -54,8 +54,15 @@ var rootCmd = &cobra.Command{ func setupLogger() { log.SetReportTimestamp(false) styles := log.DefaultStyles() - for k, v := range styles.Levels { - styles.Levels[k] = v.Width(5).MaxWidth(5) + colors := map[log.Level]string{ + log.DebugLevel: "8", + log.InfoLevel: "6", + log.WarnLevel: "3", + log.ErrorLevel: "1", + log.FatalLevel: "1", + } + for k, v := range colors { + styles.Levels[k] = styles.Levels[k].MaxWidth(5).Width(5).Foreground(lipgloss.Color(v)) } log.SetStyles(styles) }