Skip to content

Commit

Permalink
improve logging format and message
Browse files Browse the repository at this point in the history
  • Loading branch information
0g-wh committed Oct 25, 2024
1 parent 4ff4ba2 commit 2520978
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 12 deletions.
6 changes: 5 additions & 1 deletion server/util.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
12 changes: 10 additions & 2 deletions x/bank/keeper/keeper.go
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down Expand Up @@ -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(
Expand Down
9 changes: 0 additions & 9 deletions x/mint/abci.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
}

Expand Down

0 comments on commit 2520978

Please sign in to comment.