-
Notifications
You must be signed in to change notification settings - Fork 0
/
style.go
73 lines (63 loc) · 1.35 KB
/
style.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
package log
import "github.com/charmbracelet/lipgloss"
var (
TimestampStyle = lipgloss.NewStyle()
DebugLevelStyle = lipgloss.NewStyle().
SetString("DEBUG").
Bold(true).
MaxWidth(4).
Foreground(lipgloss.AdaptiveColor{
Light: "63",
Dark: "63",
})
InfoLevelStyle = lipgloss.NewStyle().
SetString("INFO").
Bold(true).
MaxWidth(4).
Foreground(lipgloss.AdaptiveColor{
Light: "39",
Dark: "86",
})
WarnLevelStyle = lipgloss.NewStyle().
SetString("WARN").
Bold(true).
MaxWidth(4).
Foreground(lipgloss.AdaptiveColor{
Light: "208",
Dark: "192",
})
ErrorLevelStyle = lipgloss.NewStyle().
SetString("ERROR").
Bold(true).
MaxWidth(4).
Foreground(lipgloss.AdaptiveColor{
Light: "203",
Dark: "204",
})
FatalLevelStyle = lipgloss.NewStyle().
SetString("FATAL").
Bold(true).
MaxWidth(4).
Foreground(lipgloss.AdaptiveColor{
Light: "133",
Dark: "134",
})
// CallerStyle is the style for caller.
CallerStyle = lipgloss.NewStyle().Faint(true)
)
func levelStyle(level Level) lipgloss.Style {
switch level {
case DebugLevel:
return DebugLevelStyle
case InfoLevel:
return InfoLevelStyle
case WarnLevel:
return WarnLevelStyle
case ErrorLevel:
return ErrorLevelStyle
case FatalLevel:
return FatalLevelStyle
default:
return lipgloss.NewStyle()
}
}