diff options
Diffstat (limited to 'cmd/utils/cmd.go')
-rw-r--r-- | cmd/utils/cmd.go | 19 |
1 files changed, 9 insertions, 10 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 } |