diff options
author | Péter Szilágyi <peterke@gmail.com> | 2017-02-23 22:49:05 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-02-23 22:49:05 +0800 |
commit | 357732a8404c9fe4d02f041d20a0d05381a3e6d1 (patch) | |
tree | edaf8a63eb7f7434cd9b9cbd764b3c4c3d76191e /node/config.go | |
parent | 29fac7de448c85049a97cbec3dc0819122bd2cb0 (diff) | |
parent | f89dd627760b43bd405cb3db1e5efdb100835db5 (diff) | |
download | dexon-357732a8404c9fe4d02f041d20a0d05381a3e6d1.tar dexon-357732a8404c9fe4d02f041d20a0d05381a3e6d1.tar.gz dexon-357732a8404c9fe4d02f041d20a0d05381a3e6d1.tar.bz2 dexon-357732a8404c9fe4d02f041d20a0d05381a3e6d1.tar.lz dexon-357732a8404c9fe4d02f041d20a0d05381a3e6d1.tar.xz dexon-357732a8404c9fe4d02f041d20a0d05381a3e6d1.tar.zst dexon-357732a8404c9fe4d02f041d20a0d05381a3e6d1.zip |
Merge pull request #3696 from karalabe/contextual-logger
Contextual logger
Diffstat (limited to 'node/config.go')
-rw-r--r-- | node/config.go | 17 |
1 files changed, 8 insertions, 9 deletions
diff --git a/node/config.go b/node/config.go index c09f51747..608c9a6b4 100644 --- a/node/config.go +++ b/node/config.go @@ -31,8 +31,7 @@ import ( "github.com/ethereum/go-ethereum/accounts/usbwallet" "github.com/ethereum/go-ethereum/common" "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" "github.com/ethereum/go-ethereum/p2p/discover" "github.com/ethereum/go-ethereum/p2p/discv5" "github.com/ethereum/go-ethereum/p2p/nat" @@ -334,7 +333,7 @@ func (c *Config) NodeKey() *ecdsa.PrivateKey { if c.DataDir == "" { key, err := crypto.GenerateKey() if err != nil { - glog.Fatalf("Failed to generate ephemeral node key: %v", err) + log.Crit(fmt.Sprintf("Failed to generate ephemeral node key: %v", err)) } return key } @@ -346,16 +345,16 @@ func (c *Config) NodeKey() *ecdsa.PrivateKey { // No persistent key found, generate and store a new one. key, err := crypto.GenerateKey() if err != nil { - glog.Fatalf("Failed to generate node key: %v", err) + log.Crit(fmt.Sprintf("Failed to generate node key: %v", err)) } instanceDir := filepath.Join(c.DataDir, c.name()) if err := os.MkdirAll(instanceDir, 0700); err != nil { - glog.V(logger.Error).Infof("Failed to persist node key: %v", err) + log.Error(fmt.Sprintf("Failed to persist node key: %v", err)) return key } keyfile = filepath.Join(instanceDir, datadirPrivateKey) if err := crypto.SaveECDSA(keyfile, key); err != nil { - glog.V(logger.Error).Infof("Failed to persist node key: %v", err) + log.Error(fmt.Sprintf("Failed to persist node key: %v", err)) } return key } @@ -383,7 +382,7 @@ func (c *Config) parsePersistentNodes(path string) []*discover.Node { // Load the nodes from the config file. var nodelist []string if err := common.LoadJSON(path, &nodelist); err != nil { - glog.V(logger.Error).Infof("Can't load node file %s: %v", path, err) + log.Error(fmt.Sprintf("Can't load node file %s: %v", path, err)) return nil } // Interpret the list as a discovery node array @@ -394,7 +393,7 @@ func (c *Config) parsePersistentNodes(path string) []*discover.Node { } node, err := discover.ParseNode(url) if err != nil { - glog.V(logger.Error).Infof("Node URL %s: %v\n", url, err) + log.Error(fmt.Sprintf("Node URL %s: %v\n", url, err)) continue } nodes = append(nodes, node) @@ -442,7 +441,7 @@ func makeAccountManager(conf *Config) (*accounts.Manager, string, error) { keystore.NewKeyStore(keydir, scryptN, scryptP), } if ledgerhub, err := usbwallet.NewLedgerHub(); err != nil { - glog.V(logger.Warn).Infof("Failed to start Ledger hub, disabling: %v", err) + log.Warn(fmt.Sprintf("Failed to start Ledger hub, disabling: %v", err)) } else { backends = append(backends, ledgerhub) } |