From 1ca20a2697e5df840a0541b61f274379b43fddc7 Mon Sep 17 00:00:00 2001 From: Péter Szilágyi Date: Wed, 22 Feb 2017 17:22:50 +0200 Subject: cmd, whisper/mailserver: revert to utils.Fatalf --- cmd/geth/chaincmd.go | 34 +++++++++++++++++----------------- 1 file changed, 17 insertions(+), 17 deletions(-) (limited to 'cmd/geth/chaincmd.go') diff --git a/cmd/geth/chaincmd.go b/cmd/geth/chaincmd.go index 1127a1090..74950697c 100644 --- a/cmd/geth/chaincmd.go +++ b/cmd/geth/chaincmd.go @@ -112,7 +112,7 @@ Use "ethereum dump 0" to dump the genesis block. func initGenesis(ctx *cli.Context) error { genesisPath := ctx.Args().First() if len(genesisPath) == 0 { - log.Crit(fmt.Sprintf("must supply path to genesis JSON file")) + utils.Fatalf("must supply path to genesis JSON file") } stack := makeFullNode(ctx) @@ -120,13 +120,13 @@ func initGenesis(ctx *cli.Context) error { genesisFile, err := os.Open(genesisPath) if err != nil { - log.Crit(fmt.Sprintf("failed to read genesis file: %v", err)) + utils.Fatalf("failed to read genesis file: %v", err) } defer genesisFile.Close() block, err := core.WriteGenesisBlock(chaindb, genesisFile) if err != nil { - log.Crit(fmt.Sprintf("failed to write genesis block: %v", err)) + utils.Fatalf("failed to write genesis block: %v", err) } log.Info(fmt.Sprintf("successfully wrote genesis block and/or chain rule set: %x", block.Hash())) return nil @@ -134,7 +134,7 @@ func initGenesis(ctx *cli.Context) error { func importChain(ctx *cli.Context) error { if len(ctx.Args()) != 1 { - log.Crit(fmt.Sprintf("This command requires an argument.")) + utils.Fatalf("This command requires an argument.") } stack := makeFullNode(ctx) chain, chainDb := utils.MakeChain(ctx, stack) @@ -158,7 +158,7 @@ func importChain(ctx *cli.Context) error { // Import the chain start := time.Now() if err := utils.ImportChain(chain, ctx.Args().First()); err != nil { - log.Crit(fmt.Sprintf("Import error: %v", err)) + utils.Fatalf("Import error: %v", err) } fmt.Printf("Import done in %v.\n\n", time.Since(start)) @@ -167,7 +167,7 @@ func importChain(ctx *cli.Context) error { stats, err := db.LDB().GetProperty("leveldb.stats") if err != nil { - log.Crit(fmt.Sprintf("Failed to read database stats: %v", err)) + utils.Fatalf("Failed to read database stats: %v", err) } fmt.Println(stats) fmt.Printf("Trie cache misses: %d\n", trie.CacheMisses()) @@ -186,13 +186,13 @@ func importChain(ctx *cli.Context) error { start = time.Now() fmt.Println("Compacting entire database...") if err = db.LDB().CompactRange(util.Range{}); err != nil { - log.Crit(fmt.Sprintf("Compaction failed: %v", err)) + utils.Fatalf("Compaction failed: %v", err) } fmt.Printf("Compaction done in %v.\n\n", time.Since(start)) stats, err = db.LDB().GetProperty("leveldb.stats") if err != nil { - log.Crit(fmt.Sprintf("Failed to read database stats: %v", err)) + utils.Fatalf("Failed to read database stats: %v", err) } fmt.Println(stats) @@ -201,7 +201,7 @@ func importChain(ctx *cli.Context) error { func exportChain(ctx *cli.Context) error { if len(ctx.Args()) < 1 { - log.Crit(fmt.Sprintf("This command requires an argument.")) + utils.Fatalf("This command requires an argument.") } stack := makeFullNode(ctx) chain, _ := utils.MakeChain(ctx, stack) @@ -216,16 +216,16 @@ func exportChain(ctx *cli.Context) error { first, ferr := strconv.ParseInt(ctx.Args().Get(1), 10, 64) last, lerr := strconv.ParseInt(ctx.Args().Get(2), 10, 64) if ferr != nil || lerr != nil { - log.Crit(fmt.Sprintf("Export error in parsing parameters: block number not an integer\n")) + utils.Fatalf("Export error in parsing parameters: block number not an integer\n") } if first < 0 || last < 0 { - log.Crit(fmt.Sprintf("Export error: block number must be greater than 0\n")) + utils.Fatalf("Export error: block number must be greater than 0\n") } err = utils.ExportAppendChain(chain, fp, uint64(first), uint64(last)) } if err != nil { - log.Crit(fmt.Sprintf("Export error: %v\n", err)) + utils.Fatalf("Export error: %v\n", err) } fmt.Printf("Export done in %v", time.Since(start)) return nil @@ -243,7 +243,7 @@ func removeDB(ctx *cli.Context) error { confirm, err := console.Stdin.PromptConfirm("Remove this database?") switch { case err != nil: - log.Crit(fmt.Sprintf("%v", err)) + utils.Fatalf("%v", err) case !confirm: fmt.Println("Operation aborted") default: @@ -269,7 +269,7 @@ func upgradeDB(ctx *cli.Context) error { filename := fmt.Sprintf("blockchain_%d_%s.chain", bcVersion, time.Now().Format("20060102_150405")) exportFile := filepath.Join(ctx.GlobalString(utils.DataDirFlag.Name), filename) if err := utils.ExportChain(chain, exportFile); err != nil { - log.Crit(fmt.Sprintf("Unable to export chain for reimport %s", err)) + utils.Fatalf("Unable to export chain for reimport %s", err) } chainDb.Close() if dir := dbDirectory(chainDb); dir != "" { @@ -282,7 +282,7 @@ func upgradeDB(ctx *cli.Context) error { err := utils.ImportChain(chain, exportFile) chainDb.Close() if err != nil { - log.Crit(fmt.Sprintf("Import error %v (a backup is made in %s, use the import command to import it)", err, exportFile)) + utils.Fatalf("Import error %v (a backup is made in %s, use the import command to import it)", err, exportFile) } else { os.Remove(exportFile) log.Info(fmt.Sprint("Import finished")) @@ -311,11 +311,11 @@ func dump(ctx *cli.Context) error { } if block == nil { fmt.Println("{}") - log.Crit(fmt.Sprintf("block not found")) + utils.Fatalf("block not found") } else { state, err := state.New(block.Root(), chainDb) if err != nil { - log.Crit(fmt.Sprintf("could not create new state: %v", err)) + utils.Fatalf("could not create new state: %v", err) } fmt.Printf("%s\n", state.Dump()) } -- cgit