diff options
Diffstat (limited to 'cmd/geth')
-rw-r--r-- | cmd/geth/accountcmd.go | 8 | ||||
-rw-r--r-- | cmd/geth/accountcmd_test.go | 16 | ||||
-rw-r--r-- | cmd/geth/chaincmd.go | 9 | ||||
-rw-r--r-- | cmd/geth/main.go | 17 |
4 files changed, 26 insertions, 24 deletions
diff --git a/cmd/geth/accountcmd.go b/cmd/geth/accountcmd.go index cd398eadb..f86be62ba 100644 --- a/cmd/geth/accountcmd.go +++ b/cmd/geth/accountcmd.go @@ -25,8 +25,7 @@ import ( "github.com/ethereum/go-ethereum/cmd/utils" "github.com/ethereum/go-ethereum/console" "github.com/ethereum/go-ethereum/crypto" - "github.com/ethereum/go-ethereum/logger" - "github.com/ethereum/go-ethereum/logger/glog" + "github.com/ethereum/go-ethereum/log" "gopkg.in/urfave/cli.v1" ) @@ -203,11 +202,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 { - glog.V(logger.Info).Infof("Unlocked account %x", account.Address) + log.Info("Unlocked account", "address", account.Address.Hex()) return account, password } if err, ok := err.(*keystore.AmbiguousAddrError); ok { - glog.V(logger.Info).Infof("Unlocked account %x", account.Address) + log.Info("Unlocked account", "address", account.Address.Hex()) return ambiguousAddrRecovery(ks, err, password), password } if err != keystore.ErrDecrypt { @@ -217,6 +216,7 @@ func unlockAccount(ctx *cli.Context, ks *keystore.KeyStore, address string, i in } // All trials expended to unlock account, bail out utils.Fatalf("Failed to unlock account %s (%v)", address, err) + return accounts.Account{}, "" } 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) { diff --git a/cmd/geth/chaincmd.go b/cmd/geth/chaincmd.go index f38ee046f..74950697c 100644 --- a/cmd/geth/chaincmd.go +++ b/cmd/geth/chaincmd.go @@ -32,8 +32,7 @@ import ( "github.com/ethereum/go-ethereum/core/state" "github.com/ethereum/go-ethereum/core/types" "github.com/ethereum/go-ethereum/ethdb" - "github.com/ethereum/go-ethereum/logger" - "github.com/ethereum/go-ethereum/logger/glog" + "github.com/ethereum/go-ethereum/log" "github.com/ethereum/go-ethereum/trie" "github.com/syndtr/goleveldb/leveldb/util" "gopkg.in/urfave/cli.v1" @@ -129,7 +128,7 @@ func initGenesis(ctx *cli.Context) error { if err != nil { utils.Fatalf("failed to write genesis block: %v", err) } - glog.V(logger.Info).Infof("successfully wrote genesis block and/or chain rule set: %x", block.Hash()) + log.Info(fmt.Sprintf("successfully wrote genesis block and/or chain rule set: %x", block.Hash())) return nil } @@ -257,7 +256,7 @@ func removeDB(ctx *cli.Context) error { } func upgradeDB(ctx *cli.Context) error { - glog.Infoln("Upgrading blockchain database") + log.Info(fmt.Sprint("Upgrading blockchain database")) stack := utils.MakeNode(ctx, clientIdentifier, gitCommit) chain, chainDb := utils.MakeChain(ctx, stack) @@ -286,7 +285,7 @@ func upgradeDB(ctx *cli.Context) error { utils.Fatalf("Import error %v (a backup is made in %s, use the import command to import it)", err, exportFile) } else { os.Remove(exportFile) - glog.Infoln("Import finished") + log.Info(fmt.Sprint("Import finished")) } return nil } diff --git a/cmd/geth/main.go b/cmd/geth/main.go index 7d98f6bb2..803a618f1 100644 --- a/cmd/geth/main.go +++ b/cmd/geth/main.go @@ -34,8 +34,7 @@ import ( "github.com/ethereum/go-ethereum/eth" "github.com/ethereum/go-ethereum/ethclient" "github.com/ethereum/go-ethereum/internal/debug" - "github.com/ethereum/go-ethereum/logger" - "github.com/ethereum/go-ethereum/logger/glog" + "github.com/ethereum/go-ethereum/log" "github.com/ethereum/go-ethereum/metrics" "github.com/ethereum/go-ethereum/node" "github.com/ethereum/go-ethereum/params" @@ -204,11 +203,11 @@ func makeFullNode(ctx *cli.Context) *node.Node { }{uint(params.VersionMajor<<16 | params.VersionMinor<<8 | params.VersionPatch), clientIdentifier, runtime.Version(), runtime.GOOS} extra, err := rlp.EncodeToBytes(clientInfo) if err != nil { - glog.V(logger.Warn).Infoln("error setting canonical miner information:", err) + log.Warn(fmt.Sprint("error setting canonical miner information:", err)) } if uint64(len(extra)) > params.MaximumExtraDataSize { - glog.V(logger.Warn).Infoln("error setting canonical miner information: extra exceeds", params.MaximumExtraDataSize) - glog.V(logger.Debug).Infof("extra: %x\n", extra) + log.Warn(fmt.Sprint("error setting canonical miner information: extra exceeds", params.MaximumExtraDataSize)) + log.Debug(fmt.Sprintf("extra: %x\n", extra)) extra = nil } stack := utils.MakeNode(ctx, clientIdentifier, gitCommit) @@ -273,7 +272,7 @@ func startNode(ctx *cli.Context, stack *node.Node) { // Open and self derive any wallets already attached for _, wallet := range stack.AccountManager().Wallets() { if err := wallet.Open(""); err != nil { - glog.V(logger.Warn).Infof("Failed to open wallet %s: %v", wallet.URL(), err) + log.Warn(fmt.Sprintf("Failed to open wallet %s: %v", wallet.URL(), err)) } else { wallet.SelfDerive(accounts.DefaultBaseDerivationPath, stateReader) } @@ -282,13 +281,13 @@ func startNode(ctx *cli.Context, stack *node.Node) { for event := range events { if event.Arrive { if err := event.Wallet.Open(""); err != nil { - glog.V(logger.Info).Infof("New wallet appeared: %s, failed to open: %s", event.Wallet.URL(), err) + log.Info(fmt.Sprintf("New wallet appeared: %s, failed to open: %s", event.Wallet.URL(), err)) } else { - glog.V(logger.Info).Infof("New wallet appeared: %s, %s", event.Wallet.URL(), event.Wallet.Status()) + log.Info(fmt.Sprintf("New wallet appeared: %s, %s", event.Wallet.URL(), event.Wallet.Status())) event.Wallet.SelfDerive(accounts.DefaultBaseDerivationPath, stateReader) } } else { - glog.V(logger.Info).Infof("Old wallet dropped: %s", event.Wallet.URL()) + log.Info(fmt.Sprintf("Old wallet dropped: %s", event.Wallet.URL())) event.Wallet.Close() } } |