Skip to content

Commit

Permalink
feature: added faint magenta as a foreground color for debug messages…
Browse files Browse the repository at this point in the history
… to increase readability
  • Loading branch information
pwntr committed Jul 10, 2024
1 parent 45f85b4 commit 3fbd1c2
Showing 1 changed file with 10 additions and 7 deletions.
17 changes: 10 additions & 7 deletions handler.go
Original file line number Diff line number Diff line change
Expand Up @@ -68,13 +68,14 @@ import (

// ANSI modes
const (
ansiReset = "\033[0m"
ansiFaint = "\033[2m"
ansiResetFaint = "\033[22m"
ansiBrightRed = "\033[91m"
ansiBrightRedFaint = "\033[91;2m"
ansiBrightGreen = "\033[92m"
ansiBrightYellow = "\033[93m"
ansiReset = "\033[0m"
ansiFaint = "\033[2m"
ansiBrightMagentaFaint = "\033[95;2m"
ansiResetFaint = "\033[22m"
ansiBrightRed = "\033[91m"
ansiBrightRedFaint = "\033[91;2m"
ansiBrightGreen = "\033[92m"
ansiBrightYellow = "\033[93m"
)

var (
Expand Down Expand Up @@ -283,8 +284,10 @@ func (h *handler) appendTime(buf *buffer, t time.Time) {
func (h *handler) appendLevel(buf *buffer, level slog.Level) {
switch {
case level < slog.LevelInfo:
buf.WriteStringIf(!h.noColor, ansiBrightMagentaFaint)
buf.WriteString("DBG")
appendLevelDelta(buf, level-slog.LevelDebug)
buf.WriteStringIf(!h.noColor, ansiReset)
case level < slog.LevelWarn:
buf.WriteStringIf(!h.noColor, ansiBrightGreen)
buf.WriteString("INF")
Expand Down

0 comments on commit 3fbd1c2

Please sign in to comment.