Skip to content

Commit

Permalink
integration: print logs to console
Browse files Browse the repository at this point in the history
  • Loading branch information
yyforyongyu committed Dec 5, 2023
1 parent 9458fd2 commit b4326cf
Showing 1 changed file with 26 additions and 0 deletions.
26 changes: 26 additions & 0 deletions integration/log.go
Original file line number Diff line number Diff line change
@@ -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)
}

0 comments on commit b4326cf

Please sign in to comment.