diff --git a/XDCx/tradingstate/orderitem.go b/XDCx/tradingstate/orderitem.go index d664efd409..a2eaf003ae 100644 --- a/XDCx/tradingstate/orderitem.go +++ b/XDCx/tradingstate/orderitem.go @@ -316,7 +316,7 @@ func IsValidRelayer(statedb *state.StateDB, address common.Address) bool { return false } if IsResignedRelayer(address, statedb) { - log.Debug("Relayer has resigned", "relayer", address.String()) + log.Debug("Relayer has resigned", "relayer", address) return false } return true diff --git a/XDCx/tradingstate/relayer_state.go b/XDCx/tradingstate/relayer_state.go index d2f1e1b20c..b1da2ae6e0 100644 --- a/XDCx/tradingstate/relayer_state.go +++ b/XDCx/tradingstate/relayer_state.go @@ -165,7 +165,7 @@ func AddTokenBalance(addr common.Address, value *big.Int, token common.Address, log.Debug("ApplyXDCXMatchedTransaction settle balance: ADD TOKEN XDC NATIVE BEFORE", "token", common.XDCNativeAddress, "address", addr, "balance", balance, "orderValue", value) statedb.AddBalance(addr, value, tracing.BalanceChangeUnspecified) balance = statedb.GetBalance(addr) - log.Debug("ApplyXDCXMatchedTransaction settle balance: ADD XDC NATIVE BALANCE AFTER", "token", token.String(), "address", addr, "balance", balance, "orderValue", value) + log.Debug("ApplyXDCXMatchedTransaction settle balance: ADD XDC NATIVE BALANCE AFTER", "token", token, "address", addr, "balance", balance, "orderValue", value) return nil } @@ -195,7 +195,7 @@ func SubTokenBalance(addr common.Address, value *big.Int, token common.Address, } statedb.SubBalance(addr, value, tracing.BalanceChangeUnspecified) balance = statedb.GetBalance(addr) - log.Debug("ApplyXDCXMatchedTransaction settle balance: SUB XDC NATIVE BALANCE AFTER", "token", token.String(), "address", addr, "balance", balance, "orderValue", value) + log.Debug("ApplyXDCXMatchedTransaction settle balance: SUB XDC NATIVE BALANCE AFTER", "token", token, "address", addr, "balance", balance, "orderValue", value) return nil } @@ -204,13 +204,13 @@ func SubTokenBalance(addr common.Address, value *big.Int, token common.Address, slot := TokenMappingSlot["balances"] locHash := common.BigToHash(GetLocMappingAtKey(addr.Hash(), slot)) balance := statedb.GetState(token, locHash).Big() - log.Debug("ApplyXDCXMatchedTransaction settle balance: SUB TOKEN BALANCE BEFORE", "token", token.String(), "address", addr, "balance", balance, "orderValue", value) + log.Debug("ApplyXDCXMatchedTransaction settle balance: SUB TOKEN BALANCE BEFORE", "token", token, "address", addr, "balance", balance, "orderValue", value) if balance.Cmp(value) < 0 { return errors.Errorf("value %s in token %s not enough , have : %s , want : %s ", addr.String(), token.String(), balance, value) } balance = new(big.Int).Sub(balance, value) statedb.SetState(token, locHash, common.BigToHash(balance)) - log.Debug("ApplyXDCXMatchedTransaction settle balance: SUB TOKEN BALANCE AFTER", "token", token.String(), "address", addr, "balance", balance, "orderValue", value) + log.Debug("ApplyXDCXMatchedTransaction settle balance: SUB TOKEN BALANCE AFTER", "token", token, "address", addr, "balance", balance, "orderValue", value) return nil } else { return errors.Errorf("token %s isn't exist", token.String()) @@ -230,7 +230,7 @@ func CheckSubTokenBalance(addr common.Address, value *big.Int, token common.Addr return nil, errors.Errorf("value %s in token %s not enough , have : %s , want : %s ", addr.String(), token.String(), balance, value) } newBalance := new(big.Int).Sub(balance, value) - log.Debug("CheckSubTokenBalance settle balance: SUB XDC NATIVE BALANCE ", "token", token, "address", addr.String(), "balance", balance, "value", value, "newBalance", newBalance) + log.Debug("CheckSubTokenBalance settle balance: SUB XDC NATIVE BALANCE ", "token", token, "address", addr, "balance", balance, "value", value, "newBalance", newBalance) return newBalance, nil } // TRC tokens diff --git a/cmd/XDC/chaincmd.go b/cmd/XDC/chaincmd.go index d7e136b0a8..700d8a83ba 100644 --- a/cmd/XDC/chaincmd.go +++ b/cmd/XDC/chaincmd.go @@ -205,7 +205,7 @@ func initGenesis(ctx *cli.Context) error { utils.Fatalf("Failed to write genesis block: %v", err) } chaindb.Close() - log.Info("Successfully wrote genesis state", "database", name, "hash", hash.String()) + log.Info("Successfully wrote genesis state", "database", name, "hash", hash) return nil } diff --git a/cmd/puppeth/wizard_genesis.go b/cmd/puppeth/wizard_genesis.go index 8585e3b0f6..bb79ce490f 100644 --- a/cmd/puppeth/wizard_genesis.go +++ b/cmd/puppeth/wizard_genesis.go @@ -358,7 +358,7 @@ func (w *wizard) makeGenesis() { storage := make(map[common.Hash]common.Hash) f := func(key, val common.Hash) bool { storage[key] = common.BytesToHash(val.Bytes()) - log.Info("DecodeBytes", "value", val.String(), "decode", storage[key].String()) + log.Info("DecodeBytes", "value", val, "decode", storage[key]) return true } contractBackend.ForEachStorageAt(ctx, validatorAddress, nil, f) diff --git a/cmd/utils/flags.go b/cmd/utils/flags.go index 6a87e0c396..b360536909 100644 --- a/cmd/utils/flags.go +++ b/cmd/utils/flags.go @@ -916,13 +916,13 @@ func setWhiteBlackListPeers(ctx *cli.Context, cfg *p2p.Config) { node1, err1 := discover.HexID(url) if err1 == nil { cfg.WhitePeers[node1] = struct{}{} - log.Info("Add peer to whitelist", "id", node1.String()) + log.Info("Add peer to whitelist", "id", node1) continue } node2, err2 := discover.ParseNode(url) if err2 == nil { cfg.WhitePeers[node2.ID] = struct{}{} - log.Info("Add peer to whitelist", "enode", url, "id", node2.ID.String()) + log.Info("Add peer to whitelist", "enode", url, "id", node2.ID) continue } log.Crit("Invalid peer id for whitelist", "url", url, "err1", err1, "err2", err2) @@ -939,13 +939,13 @@ func setWhiteBlackListPeers(ctx *cli.Context, cfg *p2p.Config) { node1, err1 := discover.HexID(url) if err1 == nil { cfg.BlackPeers[node1] = struct{}{} - log.Info("Add peer to blacklsit", "id", node1.String()) + log.Info("Add peer to blacklist", "id", node1) continue } node2, err2 := discover.ParseNode(url) if err2 == nil { cfg.BlackPeers[node2.ID] = struct{}{} - log.Info("Add peer to blacklsit", "enode", url, "id", node2.ID.String()) + log.Info("Add peer to blacklist", "enode", url, "id", node2.ID) continue } log.Crit("Invalid peer id for blacklist", "url", url, "err1", err1, "err2", err2) @@ -963,7 +963,7 @@ func removeBlackPeers(cfg *p2p.Config) { filteredNodes := make([]*discover.Node, 0, len(cfg.BootstrapNodes)) for _, node := range cfg.BootstrapNodes { if _, ok := cfg.BlackPeers[node.ID]; ok { - log.Info("Remove black peer", "enode", node.String(), "id", node.ID) + log.Info("Remove black peer", "enode", node, "id", node.ID) continue } filteredNodes = append(filteredNodes, node) @@ -1363,7 +1363,7 @@ func setSmartCard(ctx *cli.Context, cfg *node.Config) { return } if fi.Mode()&os.ModeType != os.ModeSocket { - log.Error("Invalid smartcard daemon path", "path", path, "type", fi.Mode().String()) + log.Error("Invalid smartcard daemon path", "path", path, "type", fi.Mode()) return } // Smartcard daemon path exists and is a socket, enable it diff --git a/consensus/XDPoS/XDPoS.go b/consensus/XDPoS/XDPoS.go index 6d3cad19f9..0edf373120 100644 --- a/consensus/XDPoS/XDPoS.go +++ b/consensus/XDPoS/XDPoS.go @@ -531,7 +531,7 @@ func (x *XDPoS) CacheNoneTIPSigningTxs(header *types.Header, txs []*types.Transa } } - log.Debug("Save tx signers to cache", "hash", header.Hash().String(), "number", header.Number, "len(txs)", len(signTxs)) + log.Debug("Save tx signers to cache", "hash", header.Hash(), "number", header.Number, "len(txs)", len(signTxs)) x.signingTxsCache.Add(header.Hash(), signTxs) return signTxs @@ -545,7 +545,7 @@ func (x *XDPoS) CacheSigningTxs(hash common.Hash, txs []*types.Transaction) []*t signTxs = append(signTxs, tx) } } - log.Debug("Save tx signers to cache", "hash", hash.String(), "len(txs)", len(signTxs)) + log.Debug("Save tx signers to cache", "hash", hash, "len(txs)", len(signTxs)) x.signingTxsCache.Add(hash, signTxs) return signTxs } diff --git a/consensus/XDPoS/engines/engine_v1/engine.go b/consensus/XDPoS/engines/engine_v1/engine.go index a65da6137e..9b5921c82e 100644 --- a/consensus/XDPoS/engines/engine_v1/engine.go +++ b/consensus/XDPoS/engines/engine_v1/engine.go @@ -913,7 +913,7 @@ func (x *XDPoS_v1) Seal(chain consensus.ChainReader, block *types.Block, stop <- if limit := uint64(2); number < limit || seen > number-limit { // Only take into account the non-epoch blocks if number%x.config.Epoch != 0 { - log.Info("Signed recently, must wait for others ", "len(masternodes)", len(masternodes), "number", number, "limit", limit, "seen", seen, "recent", recent.String(), "snap.Recents", snap.Recents) + log.Info("Signed recently, must wait for others ", "len(masternodes)", len(masternodes), "number", number, "limit", limit, "seen", seen, "recent", recent, "snap.Recents", snap.Recents) <-stop return nil, nil } diff --git a/contracts/utils.go b/contracts/utils.go index 933b200e52..0cd34c6c87 100644 --- a/contracts/utils.go +++ b/contracts/utils.go @@ -331,7 +331,7 @@ func GetRewardForCheckpoint(c *XDPoS.XDPoS, chain consensus.ChainReader, header mapBlkHash[i] = header.Hash() signingTxs, ok := c.GetCachedSigningTxs(header.Hash()) if !ok { - log.Debug("Failed get from cached", "hash", header.Hash().String(), "number", i) + log.Debug("Failed get from cached", "hash", header.Hash(), "number", i) block := chain.GetBlock(header.Hash(), i) txs := block.Transactions() if !chain.Config().IsTIPSigning(header.Number) { diff --git a/eth/hooks/engine_v2_hooks.go b/eth/hooks/engine_v2_hooks.go index f9e677287c..c3003ccf8d 100644 --- a/eth/hooks/engine_v2_hooks.go +++ b/eth/hooks/engine_v2_hooks.go @@ -503,7 +503,7 @@ func GetSigningTxCount(c *XDPoS.XDPoS, chain consensus.ChainReader, header *type mapBlkHash[i] = h.Hash() signingTxs, ok := c.GetCachedSigningTxs(h.Hash()) if !ok { - log.Debug("Failed get from cached", "hash", h.Hash().String(), "number", i) + log.Debug("Failed get from cached", "hash", h.Hash(), "number", i) block := chain.GetBlock(h.Hash(), i) if block != nil { txs := block.Transactions() diff --git a/internal/build/util.go b/internal/build/util.go index efce327069..8a971a560d 100644 --- a/internal/build/util.go +++ b/internal/build/util.go @@ -112,7 +112,7 @@ func RunGit(args ...string) string { } return "" } - log.Fatal(strings.Join(cmd.Args, " "), ": ", err, "\n", stderr.String()) + log.Fatal(strings.Join(cmd.Args, " "), ": ", err, "\n", stderr) } return strings.TrimSpace(stdout.String()) } diff --git a/log/logger_test.go b/log/logger_test.go index dae8497204..af40c12bf5 100644 --- a/log/logger_test.go +++ b/log/logger_test.go @@ -64,7 +64,7 @@ func TestJSONHandler(t *testing.T) { logger = slog.New(handler) logger.Debug("hi there") if len(out.String()) != 0 { - t.Errorf("expected empty debug log output, but got: %v", out.String()) + t.Errorf("expected empty debug log output, but got: %v", out) } } diff --git a/p2p/simulations/adapters/inproc.go b/p2p/simulations/adapters/inproc.go index 1867b20fe7..be7124dae4 100644 --- a/p2p/simulations/adapters/inproc.go +++ b/p2p/simulations/adapters/inproc.go @@ -86,7 +86,7 @@ func (sa *SimAdapter) NewNode(config *NodeConfig) (Node, error) { Dialer: sa, EnableMsgEvents: true, }, - Logger: log.New("node.id", id.String()), + Logger: log.New("node.id", id), }) if err != nil { return nil, err