0.2.64 update

This commit is contained in:
ponzischeme89
2026-08-15 09:23:26 +12:00
parent a2ca7e8061
commit d5d47473a2
90 changed files with 9188 additions and 451 deletions
+17
View File
@@ -2,6 +2,7 @@ package logging
import (
"bytes"
"io"
"log/slog"
"path/filepath"
"strings"
@@ -138,6 +139,22 @@ func TestBufferedLoggerRetainsStructuredEventsWithCursorPagination(t *testing.T)
}
}
func TestTailCursorReadDoesNotCopyTheRing(t *testing.T) {
logger, buffer := NewBuffered(io.Discard, slog.LevelInfo, 5_000, FormatConsole)
for range 5_000 {
logger.Info("request complete")
}
allocations := testing.AllocsPerRun(100, func() {
page := buffer.Events(5_000, 1_000)
if len(page.Events) != 0 || page.HasMore {
t.Fatalf("tail cursor unexpectedly returned events: %+v", page)
}
})
if allocations > 2 {
t.Fatalf("tail cursor allocated %.1f objects; the ring may be getting copied", allocations)
}
}
func TestPersistentBufferRestoresTheRetainedTail(t *testing.T) {
path := filepath.Join(t.TempDir(), "events.jsonl")
var output bytes.Buffer