aboutsummaryrefslogtreecommitdiffstats
path: root/p2p/testlog_test.go
blob: ac973bcf5ea15b1322e194a072c713d5cf1f1186 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
package p2p

import (
    "testing"

    "github.com/ethereum/go-ethereum/logger"
)

type testLogger struct{ t *testing.T }

func testlog(t *testing.T) testLogger {
    logger.Reset()
    l := testLogger{t}
    logger.AddLogSystem(l)
    return l
}

func (l testLogger) LogPrint(msg logger.LogMsg) {
    l.t.Logf("%s", msg.String())
}

func (testLogger) detach() {
    logger.Flush()
    logger.Reset()
}