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
This commit is contained in:
committed by
Jeffrey Wilcke
parent
82e7c1d124
commit
9184249b39
@@ -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
|
||||
}
|
||||
|
Reference in New Issue
Block a user