Log: fix ringbuffer returning oldest entry last

This commit is contained in:
andig 2024-04-20 08:39:50 +02:00
parent f4283b4d68
commit 71f7dd756f
2 changed files with 2 additions and 2 deletions

View file

@ -105,10 +105,10 @@ func (l *logger) All(areas []string, level jww.Threshold, count int) []string {
res := make([]string, 0, r.Len())
for range r.Len() {
r = r.Next()
if e, ok := r.Value.(element); ok && e != "" && (all || e.match(areas, level)) {
res = append(res, string(e))
}
r = r.Next()
}
if count > 0 && len(res) > count {

View file

@ -14,7 +14,7 @@ var (
)
func TestLog(t *testing.T) {
log := New(10)
log := New(3)
// old to new
log.Write([]byte(s1))