mirror of
https://github.com/btcsuite/btcd.git
synced 2025-01-18 05:12:27 +01:00
integration: print logs to console
This commit is contained in:
parent
c104e72151
commit
8817ebdd39
26
integration/log.go
Normal file
26
integration/log.go
Normal file
@ -0,0 +1,26 @@
|
||||
//go:build rpctest
|
||||
// +build rpctest
|
||||
|
||||
package integration
|
||||
|
||||
import (
|
||||
"os"
|
||||
|
||||
"github.com/btcsuite/btcd/rpcclient"
|
||||
"github.com/btcsuite/btclog"
|
||||
)
|
||||
|
||||
type logWriter struct{}
|
||||
|
||||
func (logWriter) Write(p []byte) (n int, err error) {
|
||||
os.Stdout.Write(p)
|
||||
return len(p), nil
|
||||
}
|
||||
|
||||
func init() {
|
||||
backendLog := btclog.NewBackend(logWriter{})
|
||||
testLog := backendLog.Logger("ITEST")
|
||||
testLog.SetLevel(btclog.LevelDebug)
|
||||
|
||||
rpcclient.UseLogger(testLog)
|
||||
}
|
Loading…
Reference in New Issue
Block a user