aboutsummaryrefslogblamecommitdiffstats
path: root/p2p/testlog_test.go
blob: c524c154c46495efa667039d3cfec9b9ecb5e6ad (plain) (tree)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
















                                                
                                                                                  









                                                                 
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 (testLogger) GetLogLevel() logger.LogLevel { return logger.DebugDetailLevel }
func (testLogger) SetLogLevel(logger.LogLevel)  {}

func (l testLogger) LogPrint(level logger.LogLevel, msg string) {
    l.t.Logf("%s", msg)
}

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