From 23602e017e30c2f2810a17a62a174d8858b6077c Mon Sep 17 00:00:00 2001 From: Elle Mouton Date: Tue, 15 Oct 2024 15:16:16 +0200 Subject: [PATCH] multi: start updating various loggers to use the new v2 type --- autopilot/log.go | 2 +- chainntnfs/log.go | 2 +- chainreg/log.go | 2 +- chanacceptor/log.go | 2 +- chanbackup/log.go | 2 +- chanfitness/log.go | 2 +- channeldb/log.go | 2 +- channeldb/migration/log.go | 2 +- channeldb/migration12/log.go | 2 +- channeldb/migration13/log.go | 2 +- channeldb/migration16/log.go | 2 +- channeldb/migration20/log.go | 2 +- channeldb/migration24/log.go | 2 +- channeldb/migration25/log.go | 2 +- channeldb/migration26/log.go | 2 +- channeldb/migration27/log.go | 2 +- channeldb/migration29/log.go | 2 +- channeldb/migration30/log.go | 2 +- channeldb/migration31/log.go | 2 +- channeldb/migration32/log.go | 2 +- channeldb/migration33/log.go | 2 +- channeldb/migration_01_to_11/log.go | 2 +- channelnotifier/log.go | 2 +- cluster/log.go | 2 +- contractcourt/log.go | 2 +- discovery/log.go | 2 +- funding/log.go | 2 +- graph/log.go | 2 +- htlcswitch/hop/log.go | 2 +- htlcswitch/log.go | 2 +- invoices/log.go | 2 +- lncfg/log.go | 2 +- lnrpc/autopilotrpc/log.go | 2 +- lnrpc/chainrpc/log.go | 2 +- lnrpc/devrpc/log.go | 2 +- lnrpc/invoicesrpc/log.go | 2 +- lnrpc/neutrinorpc/log.go | 2 +- lnrpc/peersrpc/log.go | 2 +- lnrpc/routerrpc/log.go | 2 +- lnrpc/signrpc/log.go | 2 +- lnrpc/verrpc/log.go | 2 +- lnrpc/walletrpc/log.go | 2 +- lnwallet/btcwallet/log.go | 2 +- lnwallet/chancloser/log.go | 2 +- lnwallet/chanfunding/log.go | 2 +- lnwallet/log.go | 2 +- lnwallet/rpcwallet/log.go | 2 +- log.go | 112 +++++++++++++++++----------- monitoring/log.go | 2 +- netann/log.go | 2 +- peer/log.go | 2 +- peernotifier/log.go | 2 +- routing/blindedpath/log.go | 2 +- routing/chainview/log.go | 2 +- routing/log.go | 2 +- rpcperms/interceptor.go | 2 +- rpcperms/log.go | 2 +- signal/log.go | 2 +- sweep/log.go | 2 +- watchtower/log.go | 2 +- watchtower/lookout/log.go | 2 +- watchtower/wtclient/log.go | 2 +- watchtower/wtdb/log.go | 2 +- watchtower/wtdb/migration1/log.go | 2 +- watchtower/wtdb/migration2/log.go | 2 +- watchtower/wtdb/migration3/log.go | 2 +- watchtower/wtdb/migration4/log.go | 2 +- watchtower/wtdb/migration5/log.go | 2 +- watchtower/wtdb/migration6/log.go | 2 +- watchtower/wtdb/migration7/log.go | 2 +- watchtower/wtdb/migration8/log.go | 2 +- watchtower/wtserver/log.go | 2 +- 72 files changed, 140 insertions(+), 114 deletions(-) diff --git a/autopilot/log.go b/autopilot/log.go index 34e53c846..1d86eb525 100644 --- a/autopilot/log.go +++ b/autopilot/log.go @@ -1,7 +1,7 @@ package autopilot import ( - "github.com/btcsuite/btclog" + "github.com/btcsuite/btclog/v2" "github.com/lightningnetwork/lnd/build" ) diff --git a/chainntnfs/log.go b/chainntnfs/log.go index f21246053..cc06e3bc6 100644 --- a/chainntnfs/log.go +++ b/chainntnfs/log.go @@ -1,7 +1,7 @@ package chainntnfs import ( - "github.com/btcsuite/btclog" + "github.com/btcsuite/btclog/v2" "github.com/lightningnetwork/lnd/build" ) diff --git a/chainreg/log.go b/chainreg/log.go index 267079478..1a8e1148f 100644 --- a/chainreg/log.go +++ b/chainreg/log.go @@ -1,7 +1,7 @@ package chainreg import ( - "github.com/btcsuite/btclog" + "github.com/btcsuite/btclog/v2" "github.com/lightningnetwork/lnd/build" ) diff --git a/chanacceptor/log.go b/chanacceptor/log.go index 26e131c43..3f9c925d3 100644 --- a/chanacceptor/log.go +++ b/chanacceptor/log.go @@ -1,7 +1,7 @@ package chanacceptor import ( - "github.com/btcsuite/btclog" + "github.com/btcsuite/btclog/v2" "github.com/lightningnetwork/lnd/build" ) diff --git a/chanbackup/log.go b/chanbackup/log.go index 34eb9e93f..6f7147caa 100644 --- a/chanbackup/log.go +++ b/chanbackup/log.go @@ -1,7 +1,7 @@ package chanbackup import ( - "github.com/btcsuite/btclog" + "github.com/btcsuite/btclog/v2" "github.com/lightningnetwork/lnd/build" ) diff --git a/chanfitness/log.go b/chanfitness/log.go index 626f7538d..b729c51f7 100644 --- a/chanfitness/log.go +++ b/chanfitness/log.go @@ -1,7 +1,7 @@ package chanfitness import ( - "github.com/btcsuite/btclog" + "github.com/btcsuite/btclog/v2" "github.com/lightningnetwork/lnd/build" ) diff --git a/channeldb/log.go b/channeldb/log.go index 10b1b54d3..b423154d3 100644 --- a/channeldb/log.go +++ b/channeldb/log.go @@ -1,7 +1,7 @@ package channeldb import ( - "github.com/btcsuite/btclog" + "github.com/btcsuite/btclog/v2" "github.com/lightningnetwork/lnd/build" mig "github.com/lightningnetwork/lnd/channeldb/migration" "github.com/lightningnetwork/lnd/channeldb/migration12" diff --git a/channeldb/migration/log.go b/channeldb/migration/log.go index 5085596da..b60e34978 100644 --- a/channeldb/migration/log.go +++ b/channeldb/migration/log.go @@ -1,6 +1,6 @@ package migration -import "github.com/btcsuite/btclog" +import "github.com/btcsuite/btclog/v2" // log is a logger that is initialized as disabled. This means the package will // not perform any logging by default until a logger is set. diff --git a/channeldb/migration12/log.go b/channeldb/migration12/log.go index 1352e52ae..958180842 100644 --- a/channeldb/migration12/log.go +++ b/channeldb/migration12/log.go @@ -1,7 +1,7 @@ package migration12 import ( - "github.com/btcsuite/btclog" + "github.com/btcsuite/btclog/v2" ) // log is a logger that is initialized as disabled. This means the package will diff --git a/channeldb/migration13/log.go b/channeldb/migration13/log.go index 33ec1812a..ff8169f30 100644 --- a/channeldb/migration13/log.go +++ b/channeldb/migration13/log.go @@ -1,7 +1,7 @@ package migration13 import ( - "github.com/btcsuite/btclog" + "github.com/btcsuite/btclog/v2" ) // log is a logger that is initialized as disabled. This means the package will diff --git a/channeldb/migration16/log.go b/channeldb/migration16/log.go index cb946854c..ec134bc18 100644 --- a/channeldb/migration16/log.go +++ b/channeldb/migration16/log.go @@ -1,7 +1,7 @@ package migration16 import ( - "github.com/btcsuite/btclog" + "github.com/btcsuite/btclog/v2" ) // log is a logger that is initialized as disabled. This means the package will diff --git a/channeldb/migration20/log.go b/channeldb/migration20/log.go index da75760d0..23a97de7d 100644 --- a/channeldb/migration20/log.go +++ b/channeldb/migration20/log.go @@ -1,7 +1,7 @@ package migration20 import ( - "github.com/btcsuite/btclog" + "github.com/btcsuite/btclog/v2" ) // log is a logger that is initialized as disabled. This means the package diff --git a/channeldb/migration24/log.go b/channeldb/migration24/log.go index a74cb039d..0424df79e 100644 --- a/channeldb/migration24/log.go +++ b/channeldb/migration24/log.go @@ -1,7 +1,7 @@ package migration24 import ( - "github.com/btcsuite/btclog" + "github.com/btcsuite/btclog/v2" ) // log is a logger that is initialized as disabled. This means the package will diff --git a/channeldb/migration25/log.go b/channeldb/migration25/log.go index e308d2755..07b9f60ad 100644 --- a/channeldb/migration25/log.go +++ b/channeldb/migration25/log.go @@ -1,7 +1,7 @@ package migration25 import ( - "github.com/btcsuite/btclog" + "github.com/btcsuite/btclog/v2" ) // log is a logger that is initialized as disabled. This means the package will diff --git a/channeldb/migration26/log.go b/channeldb/migration26/log.go index b7326a313..3bcd276ad 100644 --- a/channeldb/migration26/log.go +++ b/channeldb/migration26/log.go @@ -1,7 +1,7 @@ package migration26 import ( - "github.com/btcsuite/btclog" + "github.com/btcsuite/btclog/v2" ) // log is a logger that is initialized as disabled. This means the package will diff --git a/channeldb/migration27/log.go b/channeldb/migration27/log.go index 70cdb41ec..c4dd1a128 100644 --- a/channeldb/migration27/log.go +++ b/channeldb/migration27/log.go @@ -1,7 +1,7 @@ package migration27 import ( - "github.com/btcsuite/btclog" + "github.com/btcsuite/btclog/v2" ) // log is a logger that is initialized as disabled. This means the package will diff --git a/channeldb/migration29/log.go b/channeldb/migration29/log.go index b9ae19a5f..3563c074f 100644 --- a/channeldb/migration29/log.go +++ b/channeldb/migration29/log.go @@ -1,6 +1,6 @@ package migration29 -import "github.com/btcsuite/btclog" +import "github.com/btcsuite/btclog/v2" // log is a logger that is initialized as disabled. This means the package will // not perform any logging by default until a logger is set. diff --git a/channeldb/migration30/log.go b/channeldb/migration30/log.go index 1a1672fe6..8b58b99a6 100644 --- a/channeldb/migration30/log.go +++ b/channeldb/migration30/log.go @@ -1,7 +1,7 @@ package migration30 import ( - "github.com/btcsuite/btclog" + "github.com/btcsuite/btclog/v2" ) // log is a logger that is initialized as disabled. This means the package will diff --git a/channeldb/migration31/log.go b/channeldb/migration31/log.go index 2a863b7c1..42b6cadfb 100644 --- a/channeldb/migration31/log.go +++ b/channeldb/migration31/log.go @@ -1,7 +1,7 @@ package migration31 import ( - "github.com/btcsuite/btclog" + "github.com/btcsuite/btclog/v2" ) // log is a logger that is initialized as disabled. This means the package will diff --git a/channeldb/migration32/log.go b/channeldb/migration32/log.go index 98709c28e..2a921a600 100644 --- a/channeldb/migration32/log.go +++ b/channeldb/migration32/log.go @@ -1,7 +1,7 @@ package migration32 import ( - "github.com/btcsuite/btclog" + "github.com/btcsuite/btclog/v2" ) // log is a logger that is initialized as disabled. This means the package will diff --git a/channeldb/migration33/log.go b/channeldb/migration33/log.go index e9b271f5d..62b286b28 100644 --- a/channeldb/migration33/log.go +++ b/channeldb/migration33/log.go @@ -1,7 +1,7 @@ package migration33 import ( - "github.com/btcsuite/btclog" + "github.com/btcsuite/btclog/v2" ) // log is a logger that is initialized as disabled. This means the package will diff --git a/channeldb/migration_01_to_11/log.go b/channeldb/migration_01_to_11/log.go index b169b5afb..22c393261 100644 --- a/channeldb/migration_01_to_11/log.go +++ b/channeldb/migration_01_to_11/log.go @@ -1,7 +1,7 @@ package migration_01_to_11 import ( - "github.com/btcsuite/btclog" + "github.com/btcsuite/btclog/v2" ) // log is a logger that is initialized as disabled. This means the package will diff --git a/channelnotifier/log.go b/channelnotifier/log.go index 5756f6997..6044e8454 100644 --- a/channelnotifier/log.go +++ b/channelnotifier/log.go @@ -1,7 +1,7 @@ package channelnotifier import ( - "github.com/btcsuite/btclog" + "github.com/btcsuite/btclog/v2" "github.com/lightningnetwork/lnd/build" ) diff --git a/cluster/log.go b/cluster/log.go index 11ced0871..5551809c1 100644 --- a/cluster/log.go +++ b/cluster/log.go @@ -1,7 +1,7 @@ package cluster import ( - "github.com/btcsuite/btclog" + "github.com/btcsuite/btclog/v2" "github.com/lightningnetwork/lnd/build" ) diff --git a/contractcourt/log.go b/contractcourt/log.go index 2e52cc97d..21844cc3d 100644 --- a/contractcourt/log.go +++ b/contractcourt/log.go @@ -1,7 +1,7 @@ package contractcourt import ( - "github.com/btcsuite/btclog" + "github.com/btcsuite/btclog/v2" "github.com/lightningnetwork/lnd/build" ) diff --git a/discovery/log.go b/discovery/log.go index f09e7fb71..0f885e906 100644 --- a/discovery/log.go +++ b/discovery/log.go @@ -1,7 +1,7 @@ package discovery import ( - "github.com/btcsuite/btclog" + "github.com/btcsuite/btclog/v2" "github.com/lightningnetwork/lnd/build" ) diff --git a/funding/log.go b/funding/log.go index 887d4f719..357483db4 100644 --- a/funding/log.go +++ b/funding/log.go @@ -1,7 +1,7 @@ package funding import ( - "github.com/btcsuite/btclog" + "github.com/btcsuite/btclog/v2" "github.com/lightningnetwork/lnd/build" ) diff --git a/graph/log.go b/graph/log.go index 7d2f741c6..4e0315668 100644 --- a/graph/log.go +++ b/graph/log.go @@ -1,7 +1,7 @@ package graph import ( - "github.com/btcsuite/btclog" + "github.com/btcsuite/btclog/v2" "github.com/lightningnetwork/lnd/build" ) diff --git a/htlcswitch/hop/log.go b/htlcswitch/hop/log.go index 4134d1662..7b412b95d 100644 --- a/htlcswitch/hop/log.go +++ b/htlcswitch/hop/log.go @@ -1,7 +1,7 @@ package hop import ( - "github.com/btcsuite/btclog" + "github.com/btcsuite/btclog/v2" ) // log is a logger that is initialized with no output filters. This diff --git a/htlcswitch/log.go b/htlcswitch/log.go index 79259be91..f20310f8d 100644 --- a/htlcswitch/log.go +++ b/htlcswitch/log.go @@ -1,7 +1,7 @@ package htlcswitch import ( - "github.com/btcsuite/btclog" + "github.com/btcsuite/btclog/v2" "github.com/lightningnetwork/lnd/build" "github.com/lightningnetwork/lnd/htlcswitch/hop" ) diff --git a/invoices/log.go b/invoices/log.go index 5e3a0b17b..291a6aa68 100644 --- a/invoices/log.go +++ b/invoices/log.go @@ -1,7 +1,7 @@ package invoices import ( - "github.com/btcsuite/btclog" + "github.com/btcsuite/btclog/v2" "github.com/lightningnetwork/lnd/build" ) diff --git a/lncfg/log.go b/lncfg/log.go index a22a215da..f48516eb1 100644 --- a/lncfg/log.go +++ b/lncfg/log.go @@ -1,7 +1,7 @@ package lncfg import ( - "github.com/btcsuite/btclog" + "github.com/btcsuite/btclog/v2" "github.com/lightningnetwork/lnd/build" ) diff --git a/lnrpc/autopilotrpc/log.go b/lnrpc/autopilotrpc/log.go index 113486d0d..6eace3244 100644 --- a/lnrpc/autopilotrpc/log.go +++ b/lnrpc/autopilotrpc/log.go @@ -1,7 +1,7 @@ package autopilotrpc import ( - "github.com/btcsuite/btclog" + "github.com/btcsuite/btclog/v2" "github.com/lightningnetwork/lnd/build" ) diff --git a/lnrpc/chainrpc/log.go b/lnrpc/chainrpc/log.go index 6b68e324a..d592e55b0 100644 --- a/lnrpc/chainrpc/log.go +++ b/lnrpc/chainrpc/log.go @@ -1,7 +1,7 @@ package chainrpc import ( - "github.com/btcsuite/btclog" + "github.com/btcsuite/btclog/v2" "github.com/lightningnetwork/lnd/build" ) diff --git a/lnrpc/devrpc/log.go b/lnrpc/devrpc/log.go index 9cae145e5..8e13c1001 100644 --- a/lnrpc/devrpc/log.go +++ b/lnrpc/devrpc/log.go @@ -1,7 +1,7 @@ package devrpc import ( - "github.com/btcsuite/btclog" + "github.com/btcsuite/btclog/v2" "github.com/lightningnetwork/lnd/build" ) diff --git a/lnrpc/invoicesrpc/log.go b/lnrpc/invoicesrpc/log.go index f3644fdb5..7f284ad2e 100644 --- a/lnrpc/invoicesrpc/log.go +++ b/lnrpc/invoicesrpc/log.go @@ -1,7 +1,7 @@ package invoicesrpc import ( - "github.com/btcsuite/btclog" + "github.com/btcsuite/btclog/v2" "github.com/lightningnetwork/lnd/build" ) diff --git a/lnrpc/neutrinorpc/log.go b/lnrpc/neutrinorpc/log.go index fb2cd79ec..be5c9ff1b 100644 --- a/lnrpc/neutrinorpc/log.go +++ b/lnrpc/neutrinorpc/log.go @@ -1,7 +1,7 @@ package neutrinorpc import ( - "github.com/btcsuite/btclog" + "github.com/btcsuite/btclog/v2" "github.com/lightningnetwork/lnd/build" ) diff --git a/lnrpc/peersrpc/log.go b/lnrpc/peersrpc/log.go index 3fd59789c..2196fdfc9 100644 --- a/lnrpc/peersrpc/log.go +++ b/lnrpc/peersrpc/log.go @@ -1,7 +1,7 @@ package peersrpc import ( - "github.com/btcsuite/btclog" + "github.com/btcsuite/btclog/v2" "github.com/lightningnetwork/lnd/build" ) diff --git a/lnrpc/routerrpc/log.go b/lnrpc/routerrpc/log.go index 5c4ad01d8..a705e2b61 100644 --- a/lnrpc/routerrpc/log.go +++ b/lnrpc/routerrpc/log.go @@ -1,7 +1,7 @@ package routerrpc import ( - "github.com/btcsuite/btclog" + "github.com/btcsuite/btclog/v2" "github.com/lightningnetwork/lnd/build" ) diff --git a/lnrpc/signrpc/log.go b/lnrpc/signrpc/log.go index 2dc653343..cce9f7c43 100644 --- a/lnrpc/signrpc/log.go +++ b/lnrpc/signrpc/log.go @@ -1,7 +1,7 @@ package signrpc import ( - "github.com/btcsuite/btclog" + "github.com/btcsuite/btclog/v2" "github.com/lightningnetwork/lnd/build" ) diff --git a/lnrpc/verrpc/log.go b/lnrpc/verrpc/log.go index 3553b5680..a6f3546dd 100644 --- a/lnrpc/verrpc/log.go +++ b/lnrpc/verrpc/log.go @@ -1,7 +1,7 @@ package verrpc import ( - "github.com/btcsuite/btclog" + "github.com/btcsuite/btclog/v2" "github.com/lightningnetwork/lnd/build" ) diff --git a/lnrpc/walletrpc/log.go b/lnrpc/walletrpc/log.go index 1916c549f..eef49e7d0 100644 --- a/lnrpc/walletrpc/log.go +++ b/lnrpc/walletrpc/log.go @@ -1,7 +1,7 @@ package walletrpc import ( - "github.com/btcsuite/btclog" + "github.com/btcsuite/btclog/v2" "github.com/lightningnetwork/lnd/build" ) diff --git a/lnwallet/btcwallet/log.go b/lnwallet/btcwallet/log.go index 878db08e6..d0a589fed 100644 --- a/lnwallet/btcwallet/log.go +++ b/lnwallet/btcwallet/log.go @@ -1,7 +1,7 @@ package btcwallet import ( - "github.com/btcsuite/btclog" + "github.com/btcsuite/btclog/v2" "github.com/lightningnetwork/lnd/build" ) diff --git a/lnwallet/chancloser/log.go b/lnwallet/chancloser/log.go index 7189ed2a3..46c777aae 100644 --- a/lnwallet/chancloser/log.go +++ b/lnwallet/chancloser/log.go @@ -1,7 +1,7 @@ package chancloser import ( - "github.com/btcsuite/btclog" + "github.com/btcsuite/btclog/v2" "github.com/lightningnetwork/lnd/build" ) diff --git a/lnwallet/chanfunding/log.go b/lnwallet/chanfunding/log.go index 159a96ca1..4ef34f985 100644 --- a/lnwallet/chanfunding/log.go +++ b/lnwallet/chanfunding/log.go @@ -1,7 +1,7 @@ package chanfunding import ( - "github.com/btcsuite/btclog" + "github.com/btcsuite/btclog/v2" "github.com/lightningnetwork/lnd/build" ) diff --git a/lnwallet/log.go b/lnwallet/log.go index 7c8ce5198..5fde019d7 100644 --- a/lnwallet/log.go +++ b/lnwallet/log.go @@ -1,7 +1,7 @@ package lnwallet import ( - "github.com/btcsuite/btclog" + "github.com/btcsuite/btclog/v2" "github.com/btcsuite/btcwallet/chain" btcwallet "github.com/btcsuite/btcwallet/wallet" "github.com/btcsuite/btcwallet/wtxmgr" diff --git a/lnwallet/rpcwallet/log.go b/lnwallet/rpcwallet/log.go index 190aa623a..21b8a73d6 100644 --- a/lnwallet/rpcwallet/log.go +++ b/lnwallet/rpcwallet/log.go @@ -1,7 +1,7 @@ package rpcwallet import ( - "github.com/btcsuite/btclog" + "github.com/btcsuite/btclog/v2" "github.com/lightningnetwork/lnd/build" ) diff --git a/log.go b/log.go index 88c31e105..faa4f15f4 100644 --- a/log.go +++ b/log.go @@ -126,7 +126,7 @@ func SetupLoggers(root *build.SubLoggerManager, interceptor signal.Interceptor) // placeholder lnd package loggers. for _, l := range lndPkgLoggers { l.Logger = build.NewSubLogger(l.subsystem, genLogger) - SetV1SubLogger(root, l.subsystem, l.Logger) + SetSubLogger(root, l.subsystem, l.Logger) } // Initialize loggers from packages outside of `lnd` first. The @@ -144,56 +144,82 @@ func SetupLoggers(root *build.SubLoggerManager, interceptor signal.Interceptor) signal.UseLogger(ltndLog) autopilot.UseLogger(atplLog) - AddV1SubLogger(root, "LNWL", interceptor, lnwallet.UseLogger) - AddV1SubLogger(root, "DISC", interceptor, discovery.UseLogger) - AddV1SubLogger(root, "NTFN", interceptor, chainntnfs.UseLogger) - AddV1SubLogger(root, "CHDB", interceptor, channeldb.UseLogger) - AddV1SubLogger(root, "HSWC", interceptor, htlcswitch.UseLogger) - AddV1SubLogger(root, "CNCT", interceptor, contractcourt.UseLogger) - AddV1SubLogger(root, "UTXN", interceptor, contractcourt.UseNurseryLogger) - AddV1SubLogger(root, "BRAR", interceptor, contractcourt.UseBreachLogger) + AddSubLogger(root, "LNWL", interceptor, lnwallet.UseLogger) + AddSubLogger(root, "DISC", interceptor, discovery.UseLogger) + AddSubLogger(root, "NTFN", interceptor, chainntnfs.UseLogger) + AddSubLogger(root, "CHDB", interceptor, channeldb.UseLogger) + AddSubLogger(root, "HSWC", interceptor, htlcswitch.UseLogger) + AddSubLogger(root, "CNCT", interceptor, contractcourt.UseLogger) + AddSubLogger(root, "UTXN", interceptor, contractcourt.UseNurseryLogger) + AddSubLogger(root, "BRAR", interceptor, contractcourt.UseBreachLogger) AddV1SubLogger(root, "SPHX", interceptor, sphinx.UseLogger) - AddV1SubLogger(root, "SWPR", interceptor, sweep.UseLogger) - AddV1SubLogger(root, "SGNR", interceptor, signrpc.UseLogger) - AddV1SubLogger(root, "WLKT", interceptor, walletrpc.UseLogger) - AddV1SubLogger(root, "ARPC", interceptor, autopilotrpc.UseLogger) - AddV1SubLogger(root, "NRPC", interceptor, neutrinorpc.UseLogger) - AddV1SubLogger(root, "DRPC", interceptor, devrpc.UseLogger) - AddV1SubLogger(root, "INVC", interceptor, invoices.UseLogger) - AddV1SubLogger(root, "NANN", interceptor, netann.UseLogger) - AddV1SubLogger(root, "WTWR", interceptor, watchtower.UseLogger) - AddV1SubLogger(root, "NTFR", interceptor, chainrpc.UseLogger) - AddV1SubLogger(root, "IRPC", interceptor, invoicesrpc.UseLogger) - AddV1SubLogger(root, "CHNF", interceptor, channelnotifier.UseLogger) - AddV1SubLogger(root, "CHBU", interceptor, chanbackup.UseLogger) - AddV1SubLogger(root, "PROM", interceptor, monitoring.UseLogger) - AddV1SubLogger(root, "WTCL", interceptor, wtclient.UseLogger) - AddV1SubLogger(root, "PRNF", interceptor, peernotifier.UseLogger) - AddV1SubLogger(root, "CHFD", interceptor, chanfunding.UseLogger) - AddV1SubLogger(root, "PEER", interceptor, peer.UseLogger) - AddV1SubLogger(root, "CHCL", interceptor, chancloser.UseLogger) + AddSubLogger(root, "SWPR", interceptor, sweep.UseLogger) + AddSubLogger(root, "SGNR", interceptor, signrpc.UseLogger) + AddSubLogger(root, "WLKT", interceptor, walletrpc.UseLogger) + AddSubLogger(root, "ARPC", interceptor, autopilotrpc.UseLogger) + AddSubLogger(root, "NRPC", interceptor, neutrinorpc.UseLogger) + AddSubLogger(root, "DRPC", interceptor, devrpc.UseLogger) + AddSubLogger(root, "INVC", interceptor, invoices.UseLogger) + AddSubLogger(root, "NANN", interceptor, netann.UseLogger) + AddSubLogger(root, "WTWR", interceptor, watchtower.UseLogger) + AddSubLogger(root, "NTFR", interceptor, chainrpc.UseLogger) + AddSubLogger(root, "IRPC", interceptor, invoicesrpc.UseLogger) + AddSubLogger(root, "CHNF", interceptor, channelnotifier.UseLogger) + AddSubLogger(root, "CHBU", interceptor, chanbackup.UseLogger) + AddSubLogger(root, "PROM", interceptor, monitoring.UseLogger) + AddSubLogger(root, "WTCL", interceptor, wtclient.UseLogger) + AddSubLogger(root, "PRNF", interceptor, peernotifier.UseLogger) + AddSubLogger(root, "CHFD", interceptor, chanfunding.UseLogger) + AddSubLogger(root, "PEER", interceptor, peer.UseLogger) + AddSubLogger(root, "CHCL", interceptor, chancloser.UseLogger) - AddV1SubLogger(root, routing.Subsystem, interceptor, routing.UseLogger) - AddV1SubLogger(root, routerrpc.Subsystem, interceptor, routerrpc.UseLogger) - AddV1SubLogger(root, chanfitness.Subsystem, interceptor, chanfitness.UseLogger) - AddV1SubLogger(root, verrpc.Subsystem, interceptor, verrpc.UseLogger) + AddSubLogger(root, routing.Subsystem, interceptor, routing.UseLogger) + AddSubLogger(root, routerrpc.Subsystem, interceptor, routerrpc.UseLogger) + AddSubLogger(root, chanfitness.Subsystem, interceptor, chanfitness.UseLogger) + AddSubLogger(root, verrpc.Subsystem, interceptor, verrpc.UseLogger) AddV1SubLogger(root, healthcheck.Subsystem, interceptor, healthcheck.UseLogger) - AddV1SubLogger(root, chainreg.Subsystem, interceptor, chainreg.UseLogger) - AddV1SubLogger(root, chanacceptor.Subsystem, interceptor, chanacceptor.UseLogger) - AddV1SubLogger(root, funding.Subsystem, interceptor, funding.UseLogger) - AddV1SubLogger(root, cluster.Subsystem, interceptor, cluster.UseLogger) - AddV1SubLogger(root, rpcperms.Subsystem, interceptor, rpcperms.UseLogger) + AddSubLogger(root, chainreg.Subsystem, interceptor, chainreg.UseLogger) + AddSubLogger(root, chanacceptor.Subsystem, interceptor, chanacceptor.UseLogger) + AddSubLogger(root, funding.Subsystem, interceptor, funding.UseLogger) + AddSubLogger(root, cluster.Subsystem, interceptor, cluster.UseLogger) + AddSubLogger(root, rpcperms.Subsystem, interceptor, rpcperms.UseLogger) AddV1SubLogger(root, tor.Subsystem, interceptor, tor.UseLogger) - AddV1SubLogger(root, btcwallet.Subsystem, interceptor, btcwallet.UseLogger) - AddV1SubLogger(root, rpcwallet.Subsystem, interceptor, rpcwallet.UseLogger) - AddV1SubLogger(root, peersrpc.Subsystem, interceptor, peersrpc.UseLogger) - AddV1SubLogger(root, graph.Subsystem, interceptor, graph.UseLogger) - AddV1SubLogger(root, lncfg.Subsystem, interceptor, lncfg.UseLogger) - AddV1SubLogger( + AddSubLogger(root, btcwallet.Subsystem, interceptor, btcwallet.UseLogger) + AddSubLogger(root, rpcwallet.Subsystem, interceptor, rpcwallet.UseLogger) + AddSubLogger(root, peersrpc.Subsystem, interceptor, peersrpc.UseLogger) + AddSubLogger(root, graph.Subsystem, interceptor, graph.UseLogger) + AddSubLogger(root, lncfg.Subsystem, interceptor, lncfg.UseLogger) + AddSubLogger( root, blindedpath.Subsystem, interceptor, blindedpath.UseLogger, ) } +// AddSubLogger is a helper method to conveniently create and register the +// logger of one or more sub systems. +func AddSubLogger(root *build.SubLoggerManager, subsystem string, + interceptor signal.Interceptor, useLoggers ...func(btclog.Logger)) { + + // genSubLogger will return a callback for creating a logger instance, + // which we will give to the root logger. + genLogger := genSubLogger(root, interceptor) + + // Create and register just a single logger to prevent them from + // overwriting each other internally. + logger := build.NewSubLogger(subsystem, genLogger) + SetSubLogger(root, subsystem, logger, useLoggers...) +} + +// SetSubLogger is a helper method to conveniently register the logger of a +// sub system. +func SetSubLogger(root *build.SubLoggerManager, subsystem string, + logger btclog.Logger, useLoggers ...func(btclog.Logger)) { + + root.RegisterSubLogger(subsystem, logger) + for _, useLogger := range useLoggers { + useLogger(logger) + } +} + // AddV1SubLogger is a helper method to conveniently create and register the // logger of one or more sub systems. func AddV1SubLogger(root *build.SubLoggerManager, subsystem string, diff --git a/monitoring/log.go b/monitoring/log.go index a35af8523..95f0efb23 100644 --- a/monitoring/log.go +++ b/monitoring/log.go @@ -1,7 +1,7 @@ package monitoring import ( - "github.com/btcsuite/btclog" + "github.com/btcsuite/btclog/v2" "github.com/lightningnetwork/lnd/build" ) diff --git a/netann/log.go b/netann/log.go index 85d8d68c3..4aaa15bc7 100644 --- a/netann/log.go +++ b/netann/log.go @@ -1,7 +1,7 @@ package netann import ( - "github.com/btcsuite/btclog" + "github.com/btcsuite/btclog/v2" "github.com/lightningnetwork/lnd/build" ) diff --git a/peer/log.go b/peer/log.go index f0d1a6672..e4b075d19 100644 --- a/peer/log.go +++ b/peer/log.go @@ -1,7 +1,7 @@ package peer import ( - "github.com/btcsuite/btclog" + "github.com/btcsuite/btclog/v2" "github.com/lightningnetwork/lnd/build" ) diff --git a/peernotifier/log.go b/peernotifier/log.go index 1178c0f3d..a06051b26 100644 --- a/peernotifier/log.go +++ b/peernotifier/log.go @@ -1,7 +1,7 @@ package peernotifier import ( - "github.com/btcsuite/btclog" + "github.com/btcsuite/btclog/v2" "github.com/lightningnetwork/lnd/build" ) diff --git a/routing/blindedpath/log.go b/routing/blindedpath/log.go index 979884fbd..d6b39d7ef 100644 --- a/routing/blindedpath/log.go +++ b/routing/blindedpath/log.go @@ -1,7 +1,7 @@ package blindedpath import ( - "github.com/btcsuite/btclog" + "github.com/btcsuite/btclog/v2" "github.com/lightningnetwork/lnd/build" ) diff --git a/routing/chainview/log.go b/routing/chainview/log.go index b411819dd..5a2bad27f 100644 --- a/routing/chainview/log.go +++ b/routing/chainview/log.go @@ -1,7 +1,7 @@ package chainview import ( - "github.com/btcsuite/btclog" + "github.com/btcsuite/btclog/v2" "github.com/lightningnetwork/lnd/build" ) diff --git a/routing/log.go b/routing/log.go index 741ec084e..ad248bba9 100644 --- a/routing/log.go +++ b/routing/log.go @@ -1,7 +1,7 @@ package routing import ( - "github.com/btcsuite/btclog" + "github.com/btcsuite/btclog/v2" "github.com/lightningnetwork/lnd/build" "github.com/lightningnetwork/lnd/routing/chainview" ) diff --git a/rpcperms/interceptor.go b/rpcperms/interceptor.go index cea9670c4..9bbef0414 100644 --- a/rpcperms/interceptor.go +++ b/rpcperms/interceptor.go @@ -7,7 +7,7 @@ import ( "sync" "sync/atomic" - "github.com/btcsuite/btclog" + "github.com/btcsuite/btclog/v2" grpc_middleware "github.com/grpc-ecosystem/go-grpc-middleware" "github.com/lightningnetwork/lnd/lnrpc" "github.com/lightningnetwork/lnd/macaroons" diff --git a/rpcperms/log.go b/rpcperms/log.go index 209aacce5..76e4c8d40 100644 --- a/rpcperms/log.go +++ b/rpcperms/log.go @@ -1,7 +1,7 @@ package rpcperms import ( - "github.com/btcsuite/btclog" + "github.com/btcsuite/btclog/v2" "github.com/lightningnetwork/lnd/build" ) diff --git a/signal/log.go b/signal/log.go index 6bde284b7..4fcbd6d7a 100644 --- a/signal/log.go +++ b/signal/log.go @@ -1,6 +1,6 @@ package signal -import "github.com/btcsuite/btclog" +import "github.com/btcsuite/btclog/v2" // log is a logger that is initialized with no output filters. This // means the package will not perform any logging by default until the caller diff --git a/sweep/log.go b/sweep/log.go index 172502375..864c9e37a 100644 --- a/sweep/log.go +++ b/sweep/log.go @@ -1,7 +1,7 @@ package sweep import ( - "github.com/btcsuite/btclog" + "github.com/btcsuite/btclog/v2" "github.com/lightningnetwork/lnd/build" ) diff --git a/watchtower/log.go b/watchtower/log.go index 8e9062d95..bfdbe5fca 100644 --- a/watchtower/log.go +++ b/watchtower/log.go @@ -1,7 +1,7 @@ package watchtower import ( - "github.com/btcsuite/btclog" + "github.com/btcsuite/btclog/v2" "github.com/lightningnetwork/lnd/build" "github.com/lightningnetwork/lnd/watchtower/lookout" "github.com/lightningnetwork/lnd/watchtower/wtclient" diff --git a/watchtower/lookout/log.go b/watchtower/lookout/log.go index b569b4ae0..286478614 100644 --- a/watchtower/lookout/log.go +++ b/watchtower/lookout/log.go @@ -1,7 +1,7 @@ package lookout import ( - "github.com/btcsuite/btclog" + "github.com/btcsuite/btclog/v2" "github.com/lightningnetwork/lnd/build" ) diff --git a/watchtower/wtclient/log.go b/watchtower/wtclient/log.go index 8d2e37dda..dbda57bad 100644 --- a/watchtower/wtclient/log.go +++ b/watchtower/wtclient/log.go @@ -1,7 +1,7 @@ package wtclient import ( - "github.com/btcsuite/btclog" + "github.com/btcsuite/btclog/v2" "github.com/lightningnetwork/lnd/build" ) diff --git a/watchtower/wtdb/log.go b/watchtower/wtdb/log.go index fa0a64f6a..474ff08b9 100644 --- a/watchtower/wtdb/log.go +++ b/watchtower/wtdb/log.go @@ -1,7 +1,7 @@ package wtdb import ( - "github.com/btcsuite/btclog" + "github.com/btcsuite/btclog/v2" "github.com/lightningnetwork/lnd/build" "github.com/lightningnetwork/lnd/watchtower/wtdb/migration1" "github.com/lightningnetwork/lnd/watchtower/wtdb/migration2" diff --git a/watchtower/wtdb/migration1/log.go b/watchtower/wtdb/migration1/log.go index 1dc105280..f741ceaac 100644 --- a/watchtower/wtdb/migration1/log.go +++ b/watchtower/wtdb/migration1/log.go @@ -1,7 +1,7 @@ package migration1 import ( - "github.com/btcsuite/btclog" + "github.com/btcsuite/btclog/v2" ) // log is a logger that is initialized as disabled. This means the package will diff --git a/watchtower/wtdb/migration2/log.go b/watchtower/wtdb/migration2/log.go index fd64d2fcb..ae1ca59a1 100644 --- a/watchtower/wtdb/migration2/log.go +++ b/watchtower/wtdb/migration2/log.go @@ -1,7 +1,7 @@ package migration2 import ( - "github.com/btcsuite/btclog" + "github.com/btcsuite/btclog/v2" ) // log is a logger that is initialized as disabled. This means the package will diff --git a/watchtower/wtdb/migration3/log.go b/watchtower/wtdb/migration3/log.go index 2f14ff5e7..07cc2730e 100644 --- a/watchtower/wtdb/migration3/log.go +++ b/watchtower/wtdb/migration3/log.go @@ -1,7 +1,7 @@ package migration3 import ( - "github.com/btcsuite/btclog" + "github.com/btcsuite/btclog/v2" ) // log is a logger that is initialized as disabled. This means the package will diff --git a/watchtower/wtdb/migration4/log.go b/watchtower/wtdb/migration4/log.go index 3a609d76d..eb85aa5c3 100644 --- a/watchtower/wtdb/migration4/log.go +++ b/watchtower/wtdb/migration4/log.go @@ -1,7 +1,7 @@ package migration4 import ( - "github.com/btcsuite/btclog" + "github.com/btcsuite/btclog/v2" ) // log is a logger that is initialized as disabled. This means the package will diff --git a/watchtower/wtdb/migration5/log.go b/watchtower/wtdb/migration5/log.go index f0b725a2e..d92b108ad 100644 --- a/watchtower/wtdb/migration5/log.go +++ b/watchtower/wtdb/migration5/log.go @@ -1,7 +1,7 @@ package migration5 import ( - "github.com/btcsuite/btclog" + "github.com/btcsuite/btclog/v2" ) // log is a logger that is initialized as disabled. This means the package will diff --git a/watchtower/wtdb/migration6/log.go b/watchtower/wtdb/migration6/log.go index e43e7d27e..b15662bba 100644 --- a/watchtower/wtdb/migration6/log.go +++ b/watchtower/wtdb/migration6/log.go @@ -1,7 +1,7 @@ package migration6 import ( - "github.com/btcsuite/btclog" + "github.com/btcsuite/btclog/v2" ) // log is a logger that is initialized as disabled. This means the package will diff --git a/watchtower/wtdb/migration7/log.go b/watchtower/wtdb/migration7/log.go index 39f28b6c0..baf5a0990 100644 --- a/watchtower/wtdb/migration7/log.go +++ b/watchtower/wtdb/migration7/log.go @@ -1,7 +1,7 @@ package migration7 import ( - "github.com/btcsuite/btclog" + "github.com/btcsuite/btclog/v2" ) // log is a logger that is initialized as disabled. This means the package will diff --git a/watchtower/wtdb/migration8/log.go b/watchtower/wtdb/migration8/log.go index ab35682c5..412b95f8b 100644 --- a/watchtower/wtdb/migration8/log.go +++ b/watchtower/wtdb/migration8/log.go @@ -1,7 +1,7 @@ package migration8 import ( - "github.com/btcsuite/btclog" + "github.com/btcsuite/btclog/v2" ) // log is a logger that is initialized as disabled. This means the package will diff --git a/watchtower/wtserver/log.go b/watchtower/wtserver/log.go index 7939bd97f..3c901b486 100644 --- a/watchtower/wtserver/log.go +++ b/watchtower/wtserver/log.go @@ -1,7 +1,7 @@ package wtserver import ( - "github.com/btcsuite/btclog" + "github.com/btcsuite/btclog/v2" "github.com/lightningnetwork/lnd/build" )