pkg/log: fix data race on d (#2698)
* pkg/log: fix data race on d Wrap d in a mutex to prevent data race. This makes is slower, but this is a debugging aid anyway. It's not used normally. Signed-off-by: Miek Gieben <miek@miek.nl> * Fix tests compilation Signed-off-by: Miek Gieben <miek@miek.nl> * Fix test compile Signed-off-by: Miek Gieben <miek@miek.nl>
This commit is contained in:
parent
118b0c9408
commit
a84413bd07
6 changed files with 47 additions and 26 deletions
|
@ -18,7 +18,7 @@ func TestDebug(t *testing.T) {
|
|||
}
|
||||
f.Reset()
|
||||
|
||||
D = true
|
||||
D.Set()
|
||||
Debug("debug")
|
||||
if x := f.String(); !strings.Contains(x, debug+"debug") {
|
||||
t.Errorf("Expected debug log to be %s, got %s", debug+"debug", x)
|
||||
|
@ -29,7 +29,7 @@ func TestDebugx(t *testing.T) {
|
|||
var f bytes.Buffer
|
||||
golog.SetOutput(&f)
|
||||
|
||||
D = true
|
||||
D.Set()
|
||||
|
||||
Debugf("%s", "debug")
|
||||
if x := f.String(); !strings.Contains(x, debug+"debug") {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue