initial commit
This commit is contained in:
commit
d40b69f1f9
58 changed files with 7919 additions and 0 deletions
37
backend/log.go
Normal file
37
backend/log.go
Normal file
|
|
@ -0,0 +1,37 @@
|
|||
package main
|
||||
|
||||
import (
|
||||
"strings"
|
||||
|
||||
"git.red-panda.pet/pandaware/lipgloss-catppuccin"
|
||||
"github.com/charmbracelet/lipgloss"
|
||||
"github.com/charmbracelet/log"
|
||||
)
|
||||
|
||||
var (
|
||||
palette = catppuccin.Mocha
|
||||
styles *log.Styles
|
||||
)
|
||||
|
||||
func levelStyle(level log.Level, color lipgloss.Color) lipgloss.Style {
|
||||
return lipgloss.NewStyle().
|
||||
Bold(true).
|
||||
SetString(strings.TrimSpace(strings.ToUpper(level.String()))).
|
||||
MaxWidth(6).
|
||||
Align(lipgloss.Center).
|
||||
Padding(0, 1).
|
||||
Foreground(palette.Base).
|
||||
Background(color)
|
||||
}
|
||||
|
||||
func init() {
|
||||
styles = log.DefaultStyles()
|
||||
|
||||
styles.Levels = map[log.Level]lipgloss.Style{
|
||||
log.DebugLevel: levelStyle(log.DebugLevel, palette.Teal),
|
||||
log.InfoLevel: levelStyle(log.InfoLevel, palette.Sapphire),
|
||||
log.WarnLevel: levelStyle(log.WarnLevel, palette.Yellow),
|
||||
log.ErrorLevel: levelStyle(log.ErrorLevel, palette.Red),
|
||||
log.FatalLevel: levelStyle(log.FatalLevel, palette.Lavender),
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue