diff options
Diffstat (limited to 'p2p/testlog_test.go')
-rw-r--r-- | p2p/testlog_test.go | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/p2p/testlog_test.go b/p2p/testlog_test.go new file mode 100644 index 000000000..ac973bcf5 --- /dev/null +++ b/p2p/testlog_test.go @@ -0,0 +1,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() +} |