From 870d73d6e11bdde15b4e87dbcf6d014217943ba5 Mon Sep 17 00:00:00 2001 From: NeilClack Date: Sun, 10 May 2026 22:51:26 -0500 Subject: [PATCH] Filter logs to WARNING+ --- internal/page/logViewerPage.go | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/internal/page/logViewerPage.go b/internal/page/logViewerPage.go index aa735d5..0bf75ba 100644 --- a/internal/page/logViewerPage.go +++ b/internal/page/logViewerPage.go @@ -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"