Skip to content

Commit

Permalink
fix(log): use log default colors
Browse files Browse the repository at this point in the history
  • Loading branch information
aymanbagabas committed Nov 8, 2023
1 parent 7bae4c8 commit 504a206
Showing 1 changed file with 2 additions and 10 deletions.
12 changes: 2 additions & 10 deletions log/command.go
Original file line number Diff line number Diff line change
Expand Up @@ -59,20 +59,12 @@ func (o Options) Run() error {
}

st := log.DefaultStyles()
defaultColors := map[log.Level]lipgloss.Color{
log.DebugLevel: lipgloss.Color("63"),
log.InfoLevel: lipgloss.Color("86"),
log.WarnLevel: lipgloss.Color("192"),
log.ErrorLevel: lipgloss.Color("204"),
log.FatalLevel: lipgloss.Color("134"),
}

lvl := levelToLog[o.Level]
lvlStyle := o.LevelStyle.ToLipgloss()
if lvlStyle.GetForeground() == lipgloss.Color("") {
lvlStyle = lvlStyle.Foreground(defaultColors[levelToLog[o.Level]])
lvlStyle = lvlStyle.Foreground(st.Levels[lvl].GetForeground())
}

lvl := levelToLog[o.Level]
st.Levels[lvl] = lvlStyle.
SetString(strings.ToUpper(lvl.String())).
Inline(true)
Expand Down

0 comments on commit 504a206

Please sign in to comment.