From 2994d128fe4f04a0d916c57a53372f331b8b142c Mon Sep 17 00:00:00 2001 From: jholdstock Date: Tue, 19 Sep 2023 18:11:25 +0100 Subject: [PATCH] vspd: Remove funcName from info/debug logs. Including the funcName in informational log messages is not useful for devs or admins, its just spam which bloats the log file. --- internal/vspd/update.go | 18 +++++++++--------- internal/vspd/walletconsistency.go | 12 ++++++------ 2 files changed, 15 insertions(+), 15 deletions(-) diff --git a/internal/vspd/update.go b/internal/vspd/update.go index 1c56766..f561611 100644 --- a/internal/vspd/update.go +++ b/internal/vspd/update.go @@ -74,8 +74,8 @@ func (v *Vspd) updateUnconfirmed(ctx context.Context, dcrdClient *rpc.DcrdRPC) { // which expired. Remove it from the db. var e *wsrpc.Error if errors.As(err, &e) && e.Code == rpc.ErrNoTxInfo { - v.log.Infof("%s: Removing unconfirmed ticket from db - no information available "+ - "about transaction (ticketHash=%s)", funcName, ticket.Hash) + v.log.Infof("Removing unconfirmed ticket from db - no information available "+ + "about transaction (ticketHash=%s)", ticket.Hash) err = v.db.DeleteTicket(ticket) if err != nil { @@ -108,7 +108,7 @@ func (v *Vspd) updateUnconfirmed(ctx context.Context, dcrdClient *rpc.DcrdRPC) { continue } - v.log.Infof("%s: Ticket confirmed (ticketHash=%s)", funcName, ticket.Hash) + v.log.Infof("Ticket confirmed (ticketHash=%s)", ticket.Hash) } } } @@ -134,8 +134,8 @@ func (v *Vspd) broadcastFees(ctx context.Context, dcrdClient *rpc.DcrdRPC) { funcName, ticket.Hash, err) ticket.FeeTxStatus = database.FeeError } else { - v.log.Infof("%s: Fee tx broadcast for ticket (ticketHash=%s, feeHash=%s)", - funcName, ticket.Hash, ticket.FeeTxHash) + v.log.Infof("Fee tx broadcast for ticket (ticketHash=%s, feeHash=%s)", + ticket.Hash, ticket.FeeTxHash) ticket.FeeTxStatus = database.FeeBroadcast } @@ -198,7 +198,7 @@ func (v *Vspd) addToWallets(ctx context.Context, dcrdClient *rpc.DcrdRPC) { funcName, ticket.Hash, err) continue } - v.log.Infof("%s: Fee tx confirmed (ticketHash=%s)", funcName, ticket.Hash) + v.log.Infof("Fee tx confirmed (ticketHash=%s)", ticket.Hash) // Add ticket to the voting wallet. @@ -254,8 +254,8 @@ func (v *Vspd) addToWallets(ctx context.Context, dcrdClient *rpc.DcrdRPC) { } } - v.log.Infof("%s: Ticket added to voting wallet (wallet=%s, ticketHash=%s)", - funcName, walletClient.String(), ticket.Hash) + v.log.Infof("Ticket added to voting wallet (wallet=%s, ticketHash=%s)", + walletClient.String(), ticket.Hash) } } } @@ -322,7 +322,7 @@ func (v *Vspd) setOutcomes(ctx context.Context, dcrdClient *rpc.DcrdRPC) { continue } - v.log.Infof("%s: Ticket %s %s at height %d", funcName, + v.log.Infof("Ticket %s %s at height %d", dbTicket.Hash, dbTicket.Outcome, spentTicket.heightSpent) } } diff --git a/internal/vspd/walletconsistency.go b/internal/vspd/walletconsistency.go index 847e9b1..fa94094 100644 --- a/internal/vspd/walletconsistency.go +++ b/internal/vspd/walletconsistency.go @@ -75,8 +75,8 @@ func (v *Vspd) checkWalletConsistency(ctx context.Context) { continue } - v.log.Debugf("%s: Adding missing ticket (wallet=%s, ticketHash=%s)", - funcName, walletClient.String(), dbTicket.Hash) + v.log.Debugf("Adding missing ticket (wallet=%s, ticketHash=%s)", + walletClient.String(), dbTicket.Hash) rawTicket, err := dcrdClient.GetRawTransaction(dbTicket.Hash) if err != nil { @@ -99,8 +99,8 @@ func (v *Vspd) checkWalletConsistency(ctx context.Context) { // Perform a rescan if any missing tickets were added to this wallet. if added { - v.log.Infof("%s: Performing a rescan on wallet %s (fromHeight=%d)", - funcName, walletClient.String(), minHeight) + v.log.Infof("Performing a rescan on wallet %s (fromHeight=%d)", + walletClient.String(), minHeight) err = walletClient.RescanFrom(minHeight) if err != nil { v.log.Errorf("%s: dcrwallet.RescanFrom failed (wallet=%s): %v", @@ -156,8 +156,8 @@ func (v *Vspd) checkWalletConsistency(ctx context.Context) { continue } - v.log.Debugf("%s: Updating incorrect consensus vote choices (wallet=%s, agenda=%s, ticketHash=%s)", - funcName, walletClient.String(), dbAgenda, dbTicket.Hash) + v.log.Debugf("Updating incorrect consensus vote choices (wallet=%s, agenda=%s, ticketHash=%s)", + walletClient.String(), dbAgenda, dbTicket.Hash) // If db and wallet are not matching, update wallet with correct // choice.