Skip to content

Commit

Permalink
lower logging to trace (#199)
Browse files Browse the repository at this point in the history
  • Loading branch information
goran-ethernal authored Apr 18, 2024
1 parent bd84444 commit b8b90c2
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 13 deletions.
2 changes: 1 addition & 1 deletion consensus/polybft/block_builder.go
Original file line number Diff line number Diff line change
Expand Up @@ -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())
}

Expand Down
2 changes: 1 addition & 1 deletion jsonrpc/dispatcher.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
4 changes: 2 additions & 2 deletions jsonrpc/jsonrpc.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand All @@ -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 {
Expand Down
12 changes: 3 additions & 9 deletions txpool/txpool.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down Expand Up @@ -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())

Expand All @@ -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...))
Expand Down

0 comments on commit b8b90c2

Please sign in to comment.