fix: fix --log_format flag not working (#14441)

This commit is contained in:
Julien Robert 2022-12-29 10:09:16 +01:00 committed by GitHub
parent e18a0934ed
commit 82bd8880fc
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 8 additions and 2 deletions

View File

@ -110,7 +110,7 @@ Ref: https://keepachangelog.com/en/1.0.0/
* (x/gov) [#14347](https://github.com/cosmos/cosmos-sdk/pull/14347) Support `v1.Proposal` message in `v1beta1.Proposal.Content`.
* (x/gov) [#14390](https://github.com/cosmos/cosmos-sdk/pull/14390) Add title, proposer and summary to proposal struct
* (baseapp) [#14417](https://github.com/cosmos/cosmos-sdk/pull/14417) `SetStreamingService` accepts appOptions, AppCodec and Storekeys needed to set streamers.
* Store pacakge no longer has a dependency on baseapp.
* Store pacakge no longer has a dependency on baseapp.
* (store) [#14438](https://github.com/cosmos/cosmos-sdk/pull/14438) Pass logger from baseapp to store.
### State Machine Breaking
@ -207,6 +207,7 @@ extension interfaces. `module.Manager.Modules` is now of type `map[string]interf
### Bug Fixes
* (server) [#14441](https://github.com/cosmos/cosmos-sdk/pull/14441) Fix `--log_format` flag not working.
* (x/upgrade) [#13936](https://github.com/cosmos/cosmos-sdk/pull/13936) Make downgrade verification work again
* (x/group) [#13742](https://github.com/cosmos/cosmos-sdk/pull/13742) Fix `validate-genesis` when group policy accounts exist.
* (x/auth) [#13838](https://github.com/cosmos/cosmos-sdk/pull/13838) Fix calling `String()` when pubkey is set on a `BaseAccount`.

View File

@ -150,7 +150,12 @@ func InterceptConfigsPreRunHandler(cmd *cobra.Command, customAppConfigTemplate s
return err
}
logger := tmlog.NewTMLogger(tmlog.NewSyncWriter(os.Stdout))
var logger tmlog.Logger
if serverCtx.Viper.GetString(flags.FlagLogFormat) == tmcfg.LogFormatJSON {
logger = tmlog.NewTMJSONLogger(tmlog.NewSyncWriter(os.Stdout))
} else {
logger = tmlog.NewTMLogger(tmlog.NewSyncWriter(os.Stdout))
}
logger, err = tmflags.ParseLogLevel(config.LogLevel, logger, tmcfg.DefaultLogLevel)
if err != nil {
return err