Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

go.mod: bump btclog dep #9295

Merged
merged 2 commits into from
Nov 27, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 4 additions & 5 deletions build/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -67,11 +67,10 @@ func DefaultLogConfig() *LogConfig {
// config struct translates to.
func (cfg *LoggerConfig) HandlerOptions() []btclog.HandlerOption {
opts := []btclog.HandlerOption{
// The default skip depth used by the logging library is 6 but
// since we wrap the logging handlers with another level of
// abstraction with the handlerSet, we increase the skip depth
// to 7 here.
btclog.WithCallSiteSkipDepth(7),
// We wrap the logger provided by the logging library with
// another layer of abstraction with the handlerSet, and so we
// need to increase the default skip depth by 1.
btclog.WithCallSiteSkipDepth(btclog.DefaultSkipDepth + 1),
}

if cfg.NoTimestamps {
Expand Down
13 changes: 13 additions & 0 deletions build/handler_sets.go
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,19 @@ func (h *handlerSet) Level() btclogv1.Level {
return h.level
}

// WithPrefix returns a copy of the Handler but with the given string prefixed
// to each log message.
//
// NOTE: this is part of the btclog.Handler interface.
func (h *handlerSet) WithPrefix(prefix string) btclog.Handler {
newSet := &handlerSet{set: make([]btclog.Handler, len(h.set))}
for i, handler := range h.set {
newSet.set[i] = handler.WithPrefix(prefix)
}

return newSet
}

// A compile-time check to ensure that handlerSet implements btclog.Handler.
var _ btclog.Handler = (*handlerSet)(nil)

Expand Down
167 changes: 0 additions & 167 deletions build/prefix_log.go

This file was deleted.

3 changes: 1 addition & 2 deletions contractcourt/contract_resolver.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ import (

"github.com/btcsuite/btcd/wire"
"github.com/btcsuite/btclog/v2"
"github.com/lightningnetwork/lnd/build"
"github.com/lightningnetwork/lnd/channeldb"
"github.com/lightningnetwork/lnd/fn"
)
Expand Down Expand Up @@ -123,7 +122,7 @@ func newContractResolverKit(cfg ResolverConfig) *contractResolverKit {
// initLogger initializes the resolver-specific logger.
func (r *contractResolverKit) initLogger(resolver ContractResolver) {
logPrefix := fmt.Sprintf("%T(%v):", resolver, r.ChanPoint)
r.log = build.NewPrefixLog(logPrefix, log)
r.log = log.WithPrefix(logPrefix)
}

var (
Expand Down
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ require (
github.com/btcsuite/btcd/btcutil/psbt v1.1.8
github.com/btcsuite/btcd/chaincfg/chainhash v1.1.0
github.com/btcsuite/btclog v0.0.0-20241003133417-09c4e92e319c
github.com/btcsuite/btclog/v2 v2.0.0-20241017175713-3428138b75c7
github.com/btcsuite/btclog/v2 v2.0.0
github.com/btcsuite/btcwallet v0.16.10-0.20241113134707-b4ff60753aaa
github.com/btcsuite/btcwallet/wallet/txauthor v1.3.5
github.com/btcsuite/btcwallet/wallet/txrules v1.2.2
Expand Down
4 changes: 2 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -92,8 +92,8 @@ github.com/btcsuite/btcd/chaincfg/chainhash v1.1.0/go.mod h1:7SFka0XMvUgj3hfZtyd
github.com/btcsuite/btclog v0.0.0-20170628155309-84c8d2346e9f/go.mod h1:TdznJufoqS23FtqVCzL0ZqgP5MqXbb4fg/WgDys70nA=
github.com/btcsuite/btclog v0.0.0-20241003133417-09c4e92e319c h1:4HxD1lBUGUddhzgaNgrCPsFWd7cGYNpeFUgd9ZIgyM0=
github.com/btcsuite/btclog v0.0.0-20241003133417-09c4e92e319c/go.mod h1:w7xnGOhwT3lmrS4H3b/D1XAXxvh+tbhUm8xeHN2y3TQ=
github.com/btcsuite/btclog/v2 v2.0.0-20241017175713-3428138b75c7 h1:3Ct3zN3VCEKVm5nceWBBEKczc+jvTfVyOEG71ob2Yuc=
github.com/btcsuite/btclog/v2 v2.0.0-20241017175713-3428138b75c7/go.mod h1:XItGUfVOxotJL8kkuk2Hj3EVow5KCugXl3wWfQ6K0AE=
github.com/btcsuite/btclog/v2 v2.0.0 h1:ZfOBItEeLWfU0voi88K72j8vtxP4/dHhxRFf2bxZkVo=
github.com/btcsuite/btclog/v2 v2.0.0/go.mod h1:XItGUfVOxotJL8kkuk2Hj3EVow5KCugXl3wWfQ6K0AE=
github.com/btcsuite/btcutil v0.0.0-20190425235716-9e5f4b9a998d/go.mod h1:+5NJ2+qvTyV9exUAL/rxXi3DcLg2Ts+ymUAY5y4NvMg=
github.com/btcsuite/btcwallet v0.16.10-0.20241113134707-b4ff60753aaa h1:x7vYpwkPL5zeJEWPPaRunybH9ERRMGWeNf7x/0aU/38=
github.com/btcsuite/btcwallet v0.16.10-0.20241113134707-b4ff60753aaa/go.mod h1:1HJXYbjJzgumlnxOC2+ViR1U+gnHWoOn7WeK5OfY1eU=
Expand Down
3 changes: 1 addition & 2 deletions htlcswitch/link.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ import (
"github.com/btcsuite/btcd/btcutil"
"github.com/btcsuite/btcd/wire"
"github.com/btcsuite/btclog/v2"
"github.com/lightningnetwork/lnd/build"
"github.com/lightningnetwork/lnd/channeldb"
"github.com/lightningnetwork/lnd/channeldb/models"
"github.com/lightningnetwork/lnd/contractcourt"
Expand Down Expand Up @@ -508,7 +507,7 @@ func NewChannelLink(cfg ChannelLinkConfig,
channel: channel,
hodlMap: make(map[models.CircuitKey]hodlHtlc),
hodlQueue: queue.NewConcurrentQueue(10),
log: build.NewPrefixLog(logPrefix, log),
log: log.WithPrefix(logPrefix),
flushHooks: newHookMap(),
outgoingCommitHooks: newHookMap(),
incomingCommitHooks: newHookMap(),
Expand Down
3 changes: 1 addition & 2 deletions htlcswitch/quiescer.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ import (
"time"

"github.com/btcsuite/btclog/v2"
"github.com/lightningnetwork/lnd/build"
"github.com/lightningnetwork/lnd/fn"
"github.com/lightningnetwork/lnd/lntypes"
"github.com/lightningnetwork/lnd/lnwire"
Expand Down Expand Up @@ -178,7 +177,7 @@ func NewQuiescer(cfg QuiescerCfg) Quiescer {

return &QuiescerLive{
cfg: cfg,
log: build.NewPrefixLog(logPrefix, log),
log: log.WithPrefix(logPrefix),
}
}

Expand Down
3 changes: 1 addition & 2 deletions lnwallet/channel.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@ import (
"github.com/btcsuite/btcd/wire"
"github.com/btcsuite/btclog/v2"
"github.com/davecgh/go-spew/spew"
"github.com/lightningnetwork/lnd/build"
"github.com/lightningnetwork/lnd/chainntnfs"
"github.com/lightningnetwork/lnd/channeldb"
"github.com/lightningnetwork/lnd/channeldb/models"
Expand Down Expand Up @@ -955,7 +954,7 @@ func NewLightningChannel(signer input.Signer,
updateLogs: updateLogs,
Capacity: state.Capacity,
taprootNonceProducer: taprootNonceProducer,
log: build.NewPrefixLog(logPrefix, walletLog),
log: walletLog.WithPrefix(logPrefix),
opts: opts,
}

Expand Down
3 changes: 1 addition & 2 deletions peer/brontide.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ import (
"github.com/btcsuite/btclog/v2"
"github.com/davecgh/go-spew/spew"
"github.com/lightningnetwork/lnd/buffer"
"github.com/lightningnetwork/lnd/build"
"github.com/lightningnetwork/lnd/chainntnfs"
"github.com/lightningnetwork/lnd/channeldb"
"github.com/lightningnetwork/lnd/channeldb/models"
Expand Down Expand Up @@ -624,7 +623,7 @@ func NewBrontide(cfg Config) *Brontide {
resentChanSyncMsg: make(map[lnwire.ChannelID]struct{}),
startReady: make(chan struct{}),
quit: make(chan struct{}),
log: build.NewPrefixLog(logPrefix, peerLog),
log: peerLog.WithPrefix(logPrefix),
msgRouter: msgRouter,
globalMsgRouter: globalMsgRouter,
}
Expand Down
13 changes: 6 additions & 7 deletions routing/missioncontrol.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ import (
"github.com/btcsuite/btcd/btcutil"
"github.com/btcsuite/btclog/v2"
"github.com/btcsuite/btcwallet/walletdb"
"github.com/lightningnetwork/lnd/build"
"github.com/lightningnetwork/lnd/channeldb"
"github.com/lightningnetwork/lnd/clock"
"github.com/lightningnetwork/lnd/fn"
Expand Down Expand Up @@ -411,13 +410,13 @@ func (m *MissionController) initMissionControl(namespace string) (
}

mc := &MissionControl{
cfg: m.cfg,
state: newMissionControlState(cfg.MinFailureRelaxInterval),
store: store,
estimator: cfg.Estimator,
log: build.NewPrefixLog(
fmt.Sprintf("[%s]:", namespace), log,
cfg: m.cfg,
state: newMissionControlState(
cfg.MinFailureRelaxInterval,
),
store: store,
estimator: cfg.Estimator,
log: log.WithPrefix(fmt.Sprintf("[%s]:", namespace)),
onConfigUpdate: cfg.OnConfigUpdate,
}

Expand Down
3 changes: 1 addition & 2 deletions routing/payment_session.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ import (

"github.com/btcsuite/btcd/btcec/v2"
"github.com/btcsuite/btclog/v2"
"github.com/lightningnetwork/lnd/build"
"github.com/lightningnetwork/lnd/channeldb"
"github.com/lightningnetwork/lnd/channeldb/models"
"github.com/lightningnetwork/lnd/lnutils"
Expand Down Expand Up @@ -232,7 +231,7 @@ func newPaymentSession(p *LightningPayment, selfNode route.Vertex,
pathFindingConfig: pathFindingConfig,
missionControl: missionControl,
minShardAmt: DefaultShardMinAmt,
log: build.NewPrefixLog(logPrefix, log),
log: log.WithPrefix(logPrefix),
}, nil
}

Expand Down
5 changes: 1 addition & 4 deletions watchtower/wtclient/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ import (

"github.com/btcsuite/btcd/btcec/v2"
"github.com/btcsuite/btclog/v2"
"github.com/lightningnetwork/lnd/build"
"github.com/lightningnetwork/lnd/channeldb"
"github.com/lightningnetwork/lnd/keychain"
"github.com/lightningnetwork/lnd/lnwallet"
Expand Down Expand Up @@ -210,9 +209,7 @@ func newClient(cfg *clientCfg) (*client, error) {
if err != nil {
return nil, err
}
prefix := fmt.Sprintf("(%s)", identifier)

plog := build.NewPrefixLog(prefix, log)
plog := log.WithPrefix(fmt.Sprintf("(%s)", identifier))

queueDB := cfg.DB.GetDBQueue([]byte(identifier))
queue, err := NewDiskOverflowQueue[*wtdb.BackupID](
Expand Down
Loading