aboutsummaryrefslogtreecommitdiffstats
path: root/cmd/utils
diff options
context:
space:
mode:
authorPéter Szilágyi <peterke@gmail.com>2017-03-02 21:06:16 +0800
committerJeffrey Wilcke <jeffrey@ethereum.org>2017-03-02 21:06:16 +0800
commit9184249b393e4e332ae6a2f5d774880a88a9bfd6 (patch)
tree7788ce54cb04d1af4fe03ab3c2447354bcaac3cc /cmd/utils
parent82e7c1d1241737fd0ae9b25e0f20857b8597b148 (diff)
downloadgo-tangerine-9184249b393e4e332ae6a2f5d774880a88a9bfd6.tar.gz
go-tangerine-9184249b393e4e332ae6a2f5d774880a88a9bfd6.tar.zst
go-tangerine-9184249b393e4e332ae6a2f5d774880a88a9bfd6.zip
Logger updates 3 (#3730)
* accounts, cmd, eth, ethdb: port logs over to new system * ethdb: drop concept of cache distribution between dbs * eth: fix some log nitpicks to make them nicer
Diffstat (limited to 'cmd/utils')
-rw-r--r--cmd/utils/cmd.go19
-rw-r--r--cmd/utils/flags.go6
2 files changed, 12 insertions, 13 deletions
diff --git a/cmd/utils/cmd.go b/cmd/utils/cmd.go
index 843cb5b4e..17c258c6c 100644
--- a/cmd/utils/cmd.go
+++ b/cmd/utils/cmd.go
@@ -67,12 +67,12 @@ func StartNode(stack *node.Node) {
signal.Notify(sigc, os.Interrupt)
defer signal.Stop(sigc)
<-sigc
- log.Info(fmt.Sprint("Got interrupt, shutting down..."))
+ log.Info("Got interrupt, shutting down...")
go stack.Stop()
for i := 10; i > 0; i-- {
<-sigc
if i > 1 {
- log.Info(fmt.Sprintf("Already shutting down, interrupt %d more times for panic.", i-1))
+ log.Warn("Already shutting down, interrupt more to panic.", "times", i-1)
}
}
debug.Exit() // ensure trace and CPU profile data is flushed.
@@ -90,7 +90,7 @@ func ImportChain(chain *core.BlockChain, fn string) error {
defer close(interrupt)
go func() {
if _, ok := <-interrupt; ok {
- log.Info(fmt.Sprint("caught interrupt during import, will stop at next batch"))
+ log.Info("Interrupted during import, stopping at next batch")
}
close(stop)
}()
@@ -103,7 +103,7 @@ func ImportChain(chain *core.BlockChain, fn string) error {
}
}
- log.Info(fmt.Sprint("Importing blockchain ", fn))
+ log.Info("Importing blockchain", "file", fn)
fh, err := os.Open(fn)
if err != nil {
return err
@@ -151,8 +151,7 @@ func ImportChain(chain *core.BlockChain, fn string) error {
return fmt.Errorf("interrupted")
}
if hasAllBlocks(chain, blocks[:i]) {
- log.Info(fmt.Sprintf("skipping batch %d, all blocks present [%x / %x]",
- batch, blocks[0].Hash().Bytes()[:4], blocks[i-1].Hash().Bytes()[:4]))
+ log.Info("Skipping batch as all blocks present", "batch", batch, "first", blocks[0].Hash(), "last", blocks[i-1].Hash())
continue
}
@@ -173,7 +172,7 @@ func hasAllBlocks(chain *core.BlockChain, bs []*types.Block) bool {
}
func ExportChain(blockchain *core.BlockChain, fn string) error {
- log.Info(fmt.Sprint("Exporting blockchain to ", fn))
+ log.Info("Exporting blockchain", "file", fn)
fh, err := os.OpenFile(fn, os.O_CREATE|os.O_WRONLY|os.O_TRUNC, os.ModePerm)
if err != nil {
return err
@@ -189,13 +188,13 @@ func ExportChain(blockchain *core.BlockChain, fn string) error {
if err := blockchain.Export(writer); err != nil {
return err
}
- log.Info(fmt.Sprint("Exported blockchain to ", fn))
+ log.Info("Exported blockchain", "file", fn)
return nil
}
func ExportAppendChain(blockchain *core.BlockChain, fn string, first uint64, last uint64) error {
- log.Info(fmt.Sprint("Exporting blockchain to ", fn))
+ log.Info("Exporting blockchain", "file", fn)
// TODO verify mode perms
fh, err := os.OpenFile(fn, os.O_CREATE|os.O_APPEND|os.O_WRONLY, os.ModePerm)
if err != nil {
@@ -212,6 +211,6 @@ func ExportAppendChain(blockchain *core.BlockChain, fn string, first uint64, las
if err := blockchain.ExportN(writer, first, last); err != nil {
return err
}
- log.Info(fmt.Sprint("Exported blockchain to ", fn))
+ log.Info("Exported blockchain to", "file", fn)
return nil
}
diff --git a/cmd/utils/flags.go b/cmd/utils/flags.go
index a586ffeb3..adc18a203 100644
--- a/cmd/utils/flags.go
+++ b/cmd/utils/flags.go
@@ -492,7 +492,7 @@ func MakeBootstrapNodes(ctx *cli.Context) []*discover.Node {
for _, url := range urls {
node, err := discover.ParseNode(url)
if err != nil {
- log.Error(fmt.Sprintf("Bootstrap URL %s: %v\n", url, err))
+ log.Error("Bootstrap URL invalid", "enode", url, "err", err)
continue
}
bootnodes = append(bootnodes, node)
@@ -512,7 +512,7 @@ func MakeBootstrapNodesV5(ctx *cli.Context) []*discv5.Node {
for _, url := range urls {
node, err := discv5.ParseNode(url)
if err != nil {
- log.Error(fmt.Sprintf("Bootstrap URL %s: %v\n", url, err))
+ log.Error("Bootstrap URL invalid", "enode", url, "err", err)
continue
}
bootnodes = append(bootnodes, node)
@@ -609,7 +609,7 @@ func MakeAddress(ks *keystore.KeyStore, account string) (accounts.Account, error
func MakeEtherbase(ks *keystore.KeyStore, ctx *cli.Context) common.Address {
accounts := ks.Accounts()
if !ctx.GlobalIsSet(EtherbaseFlag.Name) && len(accounts) == 0 {
- log.Error(fmt.Sprint("WARNING: No etherbase set and no accounts found as default"))
+ log.Warn("No etherbase set and no accounts found as default")
return common.Address{}
}
etherbase := ctx.GlobalString(EtherbaseFlag.Name)