Filter logs to WARNING+

This commit is contained in:
NeilClack
2026-05-10 22:51:26 -05:00
parent 87d484353f
commit 870d73d6e1
+9 -6
View File
@@ -4,7 +4,7 @@ import (
"fmt"
"strings"
"time"
"slices"
"github.com/go-gl/gl/v3.3-core/gl"
"github.com/go-gl/mathgl/mgl32"
"github.com/veandco/go-sdl2/sdl"
@@ -53,12 +53,15 @@ func (p *LogViewerPage) Init(ctx *PageCtx) error {
// wrapped := wrapText(formatted, 100)
// p.lines = append(p.lines, strings.Split(wrapped, "\n")...)
// }
displayLevels := []string{"WARNING", "ERROR", "FATAL"}
for _, entry := range logs {
logTime := time.UnixMilli(entry.Timestamp)
timeStr := logTime.Format("2006-01-02 15:04:05")
line := fmt.Sprintf("[%s] [%s] %s", timeStr, entry.Level, entry.Message)
p.lines = append(p.lines, line)
if slices.Contains(displayLevels, entry.Level) {
logTime := time.UnixMilli(entry.Timestamp)
timeStr := logTime.Format("2006-01-02 15:04")
line := fmt.Sprintf("[%s] [%s] %s", timeStr, entry.Level, entry.Message)
p.lines = append(p.lines, line)
}
}
applicationFont := "Roboto-Regular"