From 23a5d64fd059bb8bdf02781608a15b8b1bdbdfd2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?P=C3=A9ter=20Szil=C3=A1gyi?= Date: Wed, 22 Feb 2017 16:58:00 +0200 Subject: accounts, cmd: port packages over to the new logging system --- cmd/geth/accountcmd.go | 4 ++-- cmd/geth/accountcmd_test.go | 16 ++++++++++------ 2 files changed, 12 insertions(+), 8 deletions(-) (limited to 'cmd/geth') diff --git a/cmd/geth/accountcmd.go b/cmd/geth/accountcmd.go index b7c411e82..0b0be7938 100644 --- a/cmd/geth/accountcmd.go +++ b/cmd/geth/accountcmd.go @@ -204,11 +204,11 @@ func unlockAccount(ctx *cli.Context, ks *keystore.KeyStore, address string, i in password := getPassPhrase(prompt, false, i, passwords) err = ks.Unlock(account, password) if err == nil { - log.Info(fmt.Sprintf("Unlocked account %x", account.Address)) + log.Info("Unlocked account", "address", account.Address.Hex()) return account, password } if err, ok := err.(*keystore.AmbiguousAddrError); ok { - log.Info(fmt.Sprintf("Unlocked account %x", account.Address)) + log.Info("Unlocked account", "address", account.Address.Hex()) return ambiguousAddrRecovery(ks, err, password), password } if err != keystore.ErrDecrypt { diff --git a/cmd/geth/accountcmd_test.go b/cmd/geth/accountcmd_test.go index 679a7ec30..adcb72454 100644 --- a/cmd/geth/accountcmd_test.go +++ b/cmd/geth/accountcmd_test.go @@ -145,7 +145,8 @@ Passphrase: {{.InputLine "foobar"}} geth.expectExit() wantMessages := []string{ - "Unlocked account f466859ead1932d743d622cb74fc058882e8648a", + "Unlocked account", + "=0xf466859ead1932d743d622cb74fc058882e8648a", } for _, m := range wantMessages { if !strings.Contains(geth.stderrText(), m) { @@ -189,8 +190,9 @@ Passphrase: {{.InputLine "foobar"}} geth.expectExit() wantMessages := []string{ - "Unlocked account 7ef5a6135f1fd6a02593eedc869c6d41d934aef8", - "Unlocked account 289d485d9771714cce91d3393d764e1311907acc", + "Unlocked account", + "=0x7ef5a6135f1fd6a02593eedc869c6d41d934aef8", + "=0x289d485d9771714cce91d3393d764e1311907acc", } for _, m := range wantMessages { if !strings.Contains(geth.stderrText(), m) { @@ -208,8 +210,9 @@ func TestUnlockFlagPasswordFile(t *testing.T) { geth.expectExit() wantMessages := []string{ - "Unlocked account 7ef5a6135f1fd6a02593eedc869c6d41d934aef8", - "Unlocked account 289d485d9771714cce91d3393d764e1311907acc", + "Unlocked account", + "=0x7ef5a6135f1fd6a02593eedc869c6d41d934aef8", + "=0x289d485d9771714cce91d3393d764e1311907acc", } for _, m := range wantMessages { if !strings.Contains(geth.stderrText(), m) { @@ -257,7 +260,8 @@ In order to avoid this warning, you need to remove the following duplicate key f geth.expectExit() wantMessages := []string{ - "Unlocked account f466859ead1932d743d622cb74fc058882e8648a", + "Unlocked account", + "=0xf466859ead1932d743d622cb74fc058882e8648a", } for _, m := range wantMessages { if !strings.Contains(geth.stderrText(), m) { -- cgit v1.2.3