From b8b90c2f9d1c5b347d2c6f4d462eb3fb6ace1ece Mon Sep 17 00:00:00 2001 From: Goran Rojovic <100121253+goran-ethernal@users.noreply.github.com> Date: Thu, 18 Apr 2024 15:06:45 +0200 Subject: [PATCH] lower logging to trace (#199) --- consensus/polybft/block_builder.go | 2 +- jsonrpc/dispatcher.go | 2 +- jsonrpc/jsonrpc.go | 4 ++-- txpool/txpool.go | 12 +++--------- 4 files changed, 7 insertions(+), 13 deletions(-) diff --git a/consensus/polybft/block_builder.go b/consensus/polybft/block_builder.go index d98efb0da4..8c0eee2552 100644 --- a/consensus/polybft/block_builder.go +++ b/consensus/polybft/block_builder.go @@ -171,7 +171,7 @@ write: default: tx := b.params.TxPool.Peek() - if b.params.Logger.IsDebug() && tx != nil { + if b.params.Logger.IsTrace() && tx != nil { _, _ = buf.WriteString(tx.String()) } diff --git a/jsonrpc/dispatcher.go b/jsonrpc/dispatcher.go index 41d1cdfd9a..c1567fc1e5 100644 --- a/jsonrpc/dispatcher.go +++ b/jsonrpc/dispatcher.go @@ -398,7 +398,7 @@ func (d *Dispatcher) Handle(reqBody []byte) ([]byte, error) { } func (d *Dispatcher) handleReq(req Request) ([]byte, Error) { - d.logger.Debug("request", "method", req.Method, "id", req.ID) + d.logger.Trace("request", "method", req.Method, "id", req.ID) service, fd, ferr := d.getFnHandler(req) if ferr != nil { diff --git a/jsonrpc/jsonrpc.go b/jsonrpc/jsonrpc.go index c018ecad40..54f85fef8b 100644 --- a/jsonrpc/jsonrpc.go +++ b/jsonrpc/jsonrpc.go @@ -356,7 +356,7 @@ func (j *JSONRPC) handleJSONRPCRequest(w http.ResponseWriter, req *http.Request) } // log request - j.logger.Debug("handle", "request", string(data)) + j.logger.Trace("handle", "request", string(data)) resp, err := j.dispatcher.Handle(data) if err != nil { @@ -365,7 +365,7 @@ func (j *JSONRPC) handleJSONRPCRequest(w http.ResponseWriter, req *http.Request) _, _ = w.Write(resp) } - j.logger.Debug("handle", "response", string(resp)) + j.logger.Trace("handle", "response", string(resp)) } type GetResponse struct { diff --git a/txpool/txpool.go b/txpool/txpool.go index cf66efe277..feb8211816 100644 --- a/txpool/txpool.go +++ b/txpool/txpool.go @@ -771,9 +771,7 @@ func (p *TxPool) pruneAccountsWithNonceHoles() { // successful, an account is created for this address // (only once) and an enqueueRequest is signaled. func (p *TxPool) addTx(origin txOrigin, tx *types.Transaction) error { - if p.logger.IsDebug() { - p.logger.Debug("add tx", "origin", origin.String(), "hash", tx.Hash().String(), "type", tx.Type()) - } + p.logger.Trace("add tx", "origin", origin.String(), "hash", tx.Hash().String(), "type", tx.Type()) // validate incoming tx if err := p.validateTx(tx); err != nil { @@ -887,9 +885,7 @@ func (p *TxPool) addTx(origin txOrigin, tx *types.Transaction) error { func (p *TxPool) invokePromotion(tx *types.Transaction, callPromote bool) { p.eventManager.signalEvent(proto.EventType_ADDED, tx.Hash()) - if p.logger.IsDebug() { - p.logger.Debug("enqueue request", "hash", tx.Hash().String()) - } + p.logger.Trace("enqueue request", "hash", tx.Hash().String()) p.eventManager.signalEvent(proto.EventType_ENQUEUED, tx.Hash()) @@ -910,9 +906,7 @@ func (p *TxPool) handlePromoteRequest(req promoteRequest) { // promote enqueued txs promoted, pruned := account.promote() - if p.logger.IsDebug() { - p.logger.Debug("promote request", "promoted", promoted, "addr", addr.String()) - } + p.logger.Trace("promote request", "promoted", promoted, "addr", addr.String()) p.index.remove(pruned...) p.gauge.decrease(slotsRequired(pruned...))