Skip to content

Commit

Permalink
hack logger
Browse files Browse the repository at this point in the history
  • Loading branch information
p0mvn committed Dec 19, 2023
1 parent 5120fe5 commit e49d2fd
Showing 1 changed file with 22 additions and 0 deletions.
22 changes: 22 additions & 0 deletions baseapp/baseapp.go
Original file line number Diff line number Diff line change
Expand Up @@ -678,6 +678,23 @@ func (app *BaseApp) runTx(mode runTxMode, txBytes []byte) (gInfo sdk.GasInfo, re
return sdk.GasInfo{}, nil, nil, 0, err
}

hasSwap := false

for _, m := range msgs {
msgString := m.String()

if strings.Contains(msgString, "MsgSwapExactAmountIn") {
hasSwap = true
}
}

// Replace logger with filter for a specific message type
logerCopy := app.logger
if hasSwap {
app.logger = app.logger.With("sim", "info")
app.logger.Info("Swap sim logger is enabled")
}

if app.anteHandler != nil {
var (
anteCtx sdk.Context
Expand Down Expand Up @@ -772,6 +789,11 @@ func (app *BaseApp) runTx(mode runTxMode, txBytes []byte) (gInfo sdk.GasInfo, re
}
}

// Revert logger
if hasSwap {
app.logger = logerCopy
}

return gInfo, result, anteEvents, priority, err
}

Expand Down

0 comments on commit e49d2fd

Please sign in to comment.