From 81e357885f0fc0fb316e529d80caeb980b22a45d Mon Sep 17 00:00:00 2001 From: mmsqe Date: Wed, 7 Feb 2024 21:22:40 +0800 Subject: [PATCH 1/2] fix: avoid cli redundant log in stdout log to stderr instead --- CHANGELOG.md | 1 + crypto/keyring/keyring.go | 4 ++-- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index ee3037aed524..1d8c604af528 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -94,6 +94,7 @@ Every module contains its own CHANGELOG.md. Please refer to the module you are i * (baseapp) [#18551](https://github.com/cosmos/cosmos-sdk/pull/18551) Fix SelectTxForProposal the calculation method of tx bytes size is inconsistent with CometBFT * (abci): [#19200](https://github.com/cosmos/cosmos-sdk/pull/19200) Ensure that sdk side ve math matches cometbft * (server) [#18994](https://github.com/cosmos/cosmos-sdk/pull/18994) Update server context directly rather than a reference to a sub-object +* (crypto) [#19371](https://github.com/cosmos/cosmos-sdk/pull/19371) Avoid cli redundant log in stdout, log to stderr instead. ### API Breaking Changes diff --git a/crypto/keyring/keyring.go b/crypto/keyring/keyring.go index 05dac4822fcf..0b0aac65d702 100644 --- a/crypto/keyring/keyring.go +++ b/crypto/keyring/keyring.go @@ -916,7 +916,7 @@ func (ks keystore) MigrateAll() ([]*Record, error) { rec, err := ks.migrate(key) if err != nil { - fmt.Printf("migrate err for key %s: %q\n", key, err) + fmt.Fprintln(os.Stderr, fmt.Sprintf("migrate err for key %s: %q\n", key, err)) continue } @@ -990,7 +990,7 @@ func (ks keystore) migrate(key string) (*Record, error) { return nil, errorsmod.Wrap(err, "unable to set keyring.Item") } - fmt.Printf("Successfully migrated key %s.\n", key) + fmt.Fprintln(os.Stderr, fmt.Sprintf("Successfully migrated key %s.\n", key)) return k, nil } From 34b55fd62fab2c13e22f2ca87cc2bd9d3e302a18 Mon Sep 17 00:00:00 2001 From: mmsqe Date: Wed, 7 Feb 2024 21:29:56 +0800 Subject: [PATCH 2/2] fix lint --- crypto/keyring/keyring.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/crypto/keyring/keyring.go b/crypto/keyring/keyring.go index 0b0aac65d702..8d0bc2018c08 100644 --- a/crypto/keyring/keyring.go +++ b/crypto/keyring/keyring.go @@ -916,7 +916,7 @@ func (ks keystore) MigrateAll() ([]*Record, error) { rec, err := ks.migrate(key) if err != nil { - fmt.Fprintln(os.Stderr, fmt.Sprintf("migrate err for key %s: %q\n", key, err)) + fmt.Fprintf(os.Stderr, "migrate err for key %s: %q\n", key, err) continue } @@ -990,7 +990,7 @@ func (ks keystore) migrate(key string) (*Record, error) { return nil, errorsmod.Wrap(err, "unable to set keyring.Item") } - fmt.Fprintln(os.Stderr, fmt.Sprintf("Successfully migrated key %s.\n", key)) + fmt.Fprintf(os.Stderr, "Successfully migrated key %s.\n", key) return k, nil }