Log: fix ringbuffer returning oldest entry last
This commit is contained in:
parent
f4283b4d68
commit
71f7dd756f
2 changed files with 2 additions and 2 deletions
|
|
@ -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 {
|
||||
|
|
|
|||
|
|
@ -14,7 +14,7 @@ var (
|
|||
)
|
||||
|
||||
func TestLog(t *testing.T) {
|
||||
log := New(10)
|
||||
log := New(3)
|
||||
|
||||
// old to new
|
||||
log.Write([]byte(s1))
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue