@@ -34,8 +34,7 @@ import (
3434 "github.com/ethereum/go-ethereum/accounts"
3535 "github.com/ethereum/go-ethereum/common"
3636 "github.com/ethereum/go-ethereum/core/types"
37- "github.com/ethereum/go-ethereum/logger"
38- "github.com/ethereum/go-ethereum/logger/glog"
37+ "github.com/ethereum/go-ethereum/log"
3938 "github.com/ethereum/go-ethereum/rlp"
4039 "github.com/karalabe/hid"
4140 "golang.org/x/net/context"
@@ -220,8 +219,8 @@ func (w *ledgerWallet) Open(passphrase string) error {
220219// - libusb on Windows doesn't support hotplug, so we can't detect USB unplugs
221220// - communication timeout on the Ledger requires a device power cycle to fix
222221func (w * ledgerWallet ) heartbeat () {
223- glog . V ( logger . Debug ). Infof ("%s health-check started" , w .url .String ())
224- defer glog . V ( logger . Debug ). Infof ("%s health-check stopped" , w .url .String ())
222+ log . Debug ( fmt . Sprintf ("%s health-check started" , w .url .String () ))
223+ defer log . Debug ( fmt . Sprintf ("%s health-check stopped" , w .url .String () ))
225224
226225 // Execute heartbeat checks until termination or error
227226 var (
@@ -260,7 +259,7 @@ func (w *ledgerWallet) heartbeat() {
260259 }
261260 // In case of error, wait for termination
262261 if err != nil {
263- glog . V ( logger . Debug ). Infof ("%s health-check failed: %v" , w .url .String (), err )
262+ log . Debug ( fmt . Sprintf ("%s health-check failed: %v" , w .url .String (), err ) )
264263 errc = <- w .healthQuit
265264 }
266265 errc <- err
@@ -348,8 +347,8 @@ func (w *ledgerWallet) Accounts() []accounts.Account {
348347// selfDerive is an account derivation loop that upon request attempts to find
349348// new non-zero accounts.
350349func (w * ledgerWallet ) selfDerive () {
351- glog . V ( logger . Debug ). Infof ("%s self-derivation started" , w .url .String ())
352- defer glog . V ( logger . Debug ). Infof ("%s self-derivation stopped" , w .url .String ())
350+ log . Debug ( fmt . Sprintf ("%s self-derivation started" , w .url .String () ))
351+ defer log . Debug ( fmt . Sprintf ("%s self-derivation stopped" , w .url .String () ))
353352
354353 // Execute self-derivations until termination or error
355354 var (
@@ -394,7 +393,7 @@ func (w *ledgerWallet) selfDerive() {
394393 // Retrieve the next derived Ethereum account
395394 if nextAddr == (common.Address {}) {
396395 if nextAddr , err = w .ledgerDerive (nextPath ); err != nil {
397- glog . V ( logger . Warn ). Infof ("%s self-derivation failed: %v" , w .url .String (), err )
396+ log . Warn ( fmt . Sprintf ("%s self-derivation failed: %v" , w .url .String (), err ) )
398397 break
399398 }
400399 }
@@ -405,12 +404,12 @@ func (w *ledgerWallet) selfDerive() {
405404 )
406405 balance , err = w .deriveChain .BalanceAt (context , nextAddr , nil )
407406 if err != nil {
408- glog . V ( logger . Warn ). Infof ("%s self-derivation balance retrieval failed: %v" , w .url .String (), err )
407+ log . Warn ( fmt . Sprintf ("%s self-derivation balance retrieval failed: %v" , w .url .String (), err ) )
409408 break
410409 }
411410 nonce , err = w .deriveChain .NonceAt (context , nextAddr , nil )
412411 if err != nil {
413- glog . V ( logger . Warn ). Infof ("%s self-derivation nonce retrieval failed: %v" , w .url .String (), err )
412+ log . Warn ( fmt . Sprintf ("%s self-derivation nonce retrieval failed: %v" , w .url .String (), err ) )
414413 break
415414 }
416415 // If the next account is empty, stop self-derivation, but add it nonetheless
@@ -430,7 +429,7 @@ func (w *ledgerWallet) selfDerive() {
430429
431430 // Display a log message to the user for new (or previously empty accounts)
432431 if _ , known := w .paths [nextAddr ]; ! known || (! empty && nextAddr == w .deriveNextAddr ) {
433- glog . V ( logger . Info ). Infof ("%s discovered %s (balance %22v, nonce %4d) at %s" , w .url .String (), nextAddr .Hex (), balance , nonce , path )
432+ log . Info ( fmt . Sprintf ("%s discovered %s (balance %22v, nonce %4d) at %s" , w .url .String (), nextAddr .Hex (), balance , nonce , path ) )
434433 }
435434 // Fetch the next potential account
436435 if ! empty {
@@ -469,7 +468,7 @@ func (w *ledgerWallet) selfDerive() {
469468 }
470469 // In case of error, wait for termination
471470 if err != nil {
472- glog . V ( logger . Debug ). Infof ("%s self-derivation failed: %s" , w .url .String (), err )
471+ log . Debug ( fmt . Sprintf ("%s self-derivation failed: %s" , w .url .String (), err ) )
473472 errc = <- w .deriveQuit
474473 }
475474 errc <- err
@@ -849,9 +848,7 @@ func (w *ledgerWallet) ledgerExchange(opcode ledgerOpcode, p1 ledgerParam1, p2 l
849848 apdu = nil
850849 }
851850 // Send over to the device
852- if glog .V (logger .Detail ) {
853- glog .Infof ("-> %s: %x" , w .device .Path , chunk )
854- }
851+ log .Trace ("" , "msg" , log.Lazy {Fn : func () string { return fmt .Sprintf ("-> %s: %x" , w .device .Path , chunk ) }})
855852 if _ , err := w .device .Write (chunk ); err != nil {
856853 return nil , err
857854 }
@@ -864,9 +861,8 @@ func (w *ledgerWallet) ledgerExchange(opcode ledgerOpcode, p1 ledgerParam1, p2 l
864861 if _ , err := io .ReadFull (w .device , chunk ); err != nil {
865862 return nil , err
866863 }
867- if glog .V (logger .Detail ) {
868- glog .Infof ("<- %s: %x" , w .device .Path , chunk )
869- }
864+ log .Trace ("" , "msg" , log.Lazy {Fn : func () string { return fmt .Sprintf ("<- %s: %x" , w .device .Path , chunk ) }})
865+
870866 // Make sure the transport header matches
871867 if chunk [0 ] != 0x01 || chunk [1 ] != 0x01 || chunk [2 ] != 0x05 {
872868 return nil , errReplyInvalidHeader
0 commit comments