@@ -231,7 +231,7 @@ func TestCallDepth(t *testing.T) {
231
231
232
232
func TestAlloc (t * testing.T ) {
233
233
ctx := context .Background ()
234
- dl := New (discardHandler {})
234
+ dl := New (discardTestHandler {})
235
235
defer SetDefault (Default ()) // restore
236
236
SetDefault (dl )
237
237
@@ -258,7 +258,7 @@ func TestAlloc(t *testing.T) {
258
258
})
259
259
})
260
260
t .Run ("2 pairs disabled inline" , func (t * testing.T ) {
261
- l := New (discardHandler { disabled : true } )
261
+ l := New (DiscardHandler )
262
262
s := "abc"
263
263
i := 2000
264
264
wantAllocs (t , 2 , func () {
@@ -269,7 +269,7 @@ func TestAlloc(t *testing.T) {
269
269
})
270
270
})
271
271
t .Run ("2 pairs disabled" , func (t * testing.T ) {
272
- l := New (discardHandler { disabled : true } )
272
+ l := New (DiscardHandler )
273
273
s := "abc"
274
274
i := 2000
275
275
wantAllocs (t , 0 , func () {
@@ -305,7 +305,7 @@ func TestAlloc(t *testing.T) {
305
305
})
306
306
})
307
307
t .Run ("attrs3 disabled" , func (t * testing.T ) {
308
- logger := New (discardHandler { disabled : true } )
308
+ logger := New (DiscardHandler )
309
309
wantAllocs (t , 0 , func () {
310
310
logger .LogAttrs (ctx , LevelInfo , "hello" , Int ("a" , 1 ), String ("b" , "two" ), Duration ("c" , time .Second ))
311
311
})
@@ -568,18 +568,17 @@ func (c *captureHandler) clear() {
568
568
c .r = Record {}
569
569
}
570
570
571
- type discardHandler struct {
572
- disabled bool
573
- attrs []Attr
571
+ type discardTestHandler struct {
572
+ attrs []Attr
574
573
}
575
574
576
- func (d discardHandler ) Enabled (context.Context , Level ) bool { return ! d . disabled }
577
- func (discardHandler ) Handle (context.Context , Record ) error { return nil }
578
- func (d discardHandler ) WithAttrs (as []Attr ) Handler {
575
+ func (d discardTestHandler ) Enabled (context.Context , Level ) bool { return true }
576
+ func (discardTestHandler ) Handle (context.Context , Record ) error { return nil }
577
+ func (d discardTestHandler ) WithAttrs (as []Attr ) Handler {
579
578
d .attrs = concat (d .attrs , as )
580
579
return d
581
580
}
582
- func (h discardHandler ) WithGroup (name string ) Handler {
581
+ func (h discardTestHandler ) WithGroup (name string ) Handler {
583
582
return h
584
583
}
585
584
0 commit comments