Skip to content

Commit

Permalink
multi: remove PrefixLog
Browse files Browse the repository at this point in the history
And instead use the new btclog Logger `WithPrefix` method.
  • Loading branch information
ellemouton committed Nov 27, 2024
1 parent c0c6ff0 commit e4476a8
Show file tree
Hide file tree
Showing 8 changed files with 12 additions and 201 deletions.
180 changes: 0 additions & 180 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
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 @@ -472,7 +471,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 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 @@ -620,7 +619,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

0 comments on commit e4476a8

Please sign in to comment.