|
|
|
@ -2,6 +2,7 @@ package log |
|
|
|
|
|
|
|
|
|
import ( |
|
|
|
|
"bytes" |
|
|
|
|
"context" |
|
|
|
|
"fmt" |
|
|
|
|
"os" |
|
|
|
|
"strings" |
|
|
|
@ -83,3 +84,12 @@ func TestGlobalLogUpdate(t *testing.T) { |
|
|
|
|
t.Errorf("Expected: %s, got: %s", expected, buffer.String()) |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
func TestGolbalContext(t *testing.T) { |
|
|
|
|
buffer := &bytes.Buffer{} |
|
|
|
|
SetLogger(NewStdLogger(buffer)) |
|
|
|
|
Context(context.Background()).Infof("111") |
|
|
|
|
if buffer.String() != "INFO msg=111\n" { |
|
|
|
|
t.Errorf("Expected:%s, got:%s", "INFO msg=111", buffer.String()) |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|