From 7efc6fb01267c8bd38d437d61c5de5cd5303ba7d Mon Sep 17 00:00:00 2001 From: Sad Pencil Date: Sat, 23 Feb 2019 06:38:13 +0800 Subject: [PATCH] t6 --- log2/logger.go | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/log2/logger.go b/log2/logger.go index 18ad37fc4b..3d359bd382 100644 --- a/log2/logger.go +++ b/log2/logger.go @@ -2,7 +2,7 @@ package log2 import ( "encoding/json" - "log" + "fmt" "os" ) @@ -18,12 +18,16 @@ type TimingLog struct { func InitOutputFile(outputFile string) { if outputFile == "" { - log.Fatalln("You must specify the log file, e.g. \"geth --timing.output=/path/to/file.txt\"") + fmt.Fprintln(os.Stderr, "You must specify the log file, e.g. \"geth --timing.output=/path/to/file.txt\"") + os.Exit(1) } var err error file, err = os.OpenFile(outputFile, os.O_APPEND|os.O_CREATE, 0644) if err != nil { - log.Fatalln("Fail to create log file for timing.") + fmt.Fprintln(os.Stderr, "Fail to create log file for timing.") + fmt.Fprintln(os.Stderr, err) + + os.Exit(1) } } func Record(timingLog TimingLog) error {