Fix log viewer to properly capture logs (v0.38.0)
Some checks failed
Go / build-and-release (push) Has been cancelled

- Reinitialize lol loggers after wrapping Writer with BufferedWriter
- The lol.Main logger was initialized in init() with os.Stderr directly,
  bypassing the Writer variable, so we now recreate it with the wrapped Writer
- Log level changes now properly affect both the buffer and syslog output

Files modified:
- app/config/config.go: Reinitialize loggers after BufferedWriter setup
- pkg/logbuffer/writer.go: Remove unused stub function

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
2025-12-25 14:01:36 +01:00
parent 8e5754e799
commit 02db40de59
3 changed files with 12 additions and 1 deletions

View File

@@ -24,6 +24,7 @@ import (
"go-simpler.org/env"
lol "lol.mleku.dev"
"lol.mleku.dev/chk"
"lol.mleku.dev/log"
"next.orly.dev/pkg/logbuffer"
"next.orly.dev/pkg/version"
)
@@ -185,6 +186,15 @@ func New() (cfg *C, err error) {
logbuffer.Init(cfg.LogBufferSize)
logbuffer.SetCurrentLevel(cfg.LogLevel)
lol.Writer = logbuffer.NewBufferedWriter(lol.Writer, logbuffer.GlobalBuffer)
// Reinitialize the loggers to use the new wrapped Writer
// The lol.Main logger is initialized in init() with os.Stderr directly,
// so we need to recreate it with the new Writer
l, c, e := lol.New(lol.Writer, 2)
lol.Main.Log = l
lol.Main.Check = c
lol.Main.Errorf = e
// Also update the log package convenience variables
log.F, log.E, log.W, log.I, log.D, log.T = l.F, l.E, l.W, l.I, l.D, l.T
}
lol.SetLogLevel(cfg.LogLevel)
return

View File

@@ -136,3 +136,4 @@ func SetCurrentLevel(level string) string {
}
return currentLevel
}

View File

@@ -1 +1 @@
v0.37.3
v0.38.0