From 25209787e653c8fa94409fc7bff0866aea27920d Mon Sep 17 00:00:00 2001 From: 0g-wh Date: Fri, 25 Oct 2024 03:22:44 +0000 Subject: [PATCH] improve logging format and message --- server/util.go | 6 +++++- x/bank/keeper/keeper.go | 12 ++++++++++-- x/mint/abci.go | 9 --------- 3 files changed, 15 insertions(+), 12 deletions(-) diff --git a/server/util.go b/server/util.go index 063917545b..f6c3339788 100644 --- a/server/util.go +++ b/server/util.go @@ -166,7 +166,11 @@ func InterceptConfigsPreRunHandler(cmd *cobra.Command, customAppConfigTemplate s opts = append(opts, log.ColorOption(!serverCtx.Viper.GetBool(flags.FlagLogNoColor)), // We use CometBFT flag (cmtcli.TraceFlag) for trace logging. - log.TraceOption(serverCtx.Viper.GetBool(FlagTrace))) + log.TraceOption(serverCtx.Viper.GetBool(FlagTrace)), + log.TimeFormatOption("01-02T15:04:05.000"), + ) + + zerolog.TimeFieldFormat = zerolog.TimeFormatUnixMs // check and set filter level or keys for the logger if any logLvlStr := serverCtx.Viper.GetString(flags.FlagLogLevel) diff --git a/x/bank/keeper/keeper.go b/x/bank/keeper/keeper.go index d0c59e8ec6..bac90c9b9a 100644 --- a/x/bank/keeper/keeper.go +++ b/x/bank/keeper/keeper.go @@ -442,7 +442,11 @@ func (k BaseKeeper) MintCoins(ctx sdk.Context, moduleName string, amounts sdk.Co } logger := k.Logger(ctx) - logger.Info("minted coins from module account", "amount", amounts.String(), "from", moduleName) + if moduleName == "evm" { + logger.Debug("minted coins from module account", "amount", amounts.String(), "from", moduleName) + } else { + logger.Info("minted coins from module account", "amount", amounts.String(), "from", moduleName) + } // emit mint event ctx.EventManager().EmitEvent( @@ -476,7 +480,11 @@ func (k BaseKeeper) BurnCoins(ctx sdk.Context, moduleName string, amounts sdk.Co } logger := k.Logger(ctx) - logger.Info("burned tokens from module account", "amount", amounts.String(), "from", moduleName) + if moduleName == "evm" { + logger.Debug("burned tokens from module account", "amount", amounts.String(), "from", moduleName) + } else { + logger.Info("burned tokens from module account", "amount", amounts.String(), "from", moduleName) + } // emit burn event ctx.EventManager().EmitEvent( diff --git a/x/mint/abci.go b/x/mint/abci.go index a0b2ee51ed..ee469b7b91 100644 --- a/x/mint/abci.go +++ b/x/mint/abci.go @@ -19,7 +19,6 @@ func decExp(x sdk.Dec) sdk.Dec { func NextInflationRate(ctx sdk.Context, params types.Params, bondedRatio sdk.Dec, circulatingRatio sdk.Dec) sdk.Dec { X := bondedRatio.Quo(circulatingRatio) - ctx.Logger().Info("NextInflationRate", "params", params) var apy sdk.Dec if X.LT(params.MinStakedRatio) { apy = params.ApyAtMinStakedRatio @@ -37,14 +36,6 @@ func NextInflationRate(ctx sdk.Context, params types.Params, bondedRatio sdk.Dec inflation := apy.Mul(bondedRatio) - ctx.Logger().Info( - "nextInflationRate", - "bondedRatio", bondedRatio, - "circulatingRatio", circulatingRatio, - "apy", apy, - "inflation", inflation, - "params", params, - ) return inflation }