From e49d2fd0bc346f5075ed757372f57b10f880a5cd Mon Sep 17 00:00:00 2001 From: Roman Date: Tue, 19 Dec 2023 12:23:18 -0700 Subject: [PATCH] hack logger --- baseapp/baseapp.go | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/baseapp/baseapp.go b/baseapp/baseapp.go index 84c16fab5318..6463c7f85c2c 100644 --- a/baseapp/baseapp.go +++ b/baseapp/baseapp.go @@ -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 @@ -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 }