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 Jan 15, 2024
1 parent c104e72 commit 8817ebd
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 8817ebd

Please sign in to comment.