diff options
author | Jimmy Hu <jimmy.hu@dexon.org> | 2018-09-13 17:30:42 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-09-13 17:30:42 +0800 |
commit | ce3e7931016bb5f3a68e1b27e308bb54522b34a4 (patch) | |
tree | 56ff2ec31a1c8dfcdad80772815de75438f29a79 /cmd/dexcon-simulation/main.go | |
parent | 41f4c2fd789d6b58ca076e675b2ce931aaedb37b (diff) | |
download | dexon-consensus-ce3e7931016bb5f3a68e1b27e308bb54522b34a4.tar dexon-consensus-ce3e7931016bb5f3a68e1b27e308bb54522b34a4.tar.gz dexon-consensus-ce3e7931016bb5f3a68e1b27e308bb54522b34a4.tar.bz2 dexon-consensus-ce3e7931016bb5f3a68e1b27e308bb54522b34a4.tar.lz dexon-consensus-ce3e7931016bb5f3a68e1b27e308bb54522b34a4.tar.xz dexon-consensus-ce3e7931016bb5f3a68e1b27e308bb54522b34a4.tar.zst dexon-consensus-ce3e7931016bb5f3a68e1b27e308bb54522b34a4.zip |
core: Fix BA Fork issues (#104)
Diffstat (limited to 'cmd/dexcon-simulation/main.go')
-rw-r--r-- | cmd/dexcon-simulation/main.go | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/cmd/dexcon-simulation/main.go b/cmd/dexcon-simulation/main.go index 126b832..3334d23 100644 --- a/cmd/dexcon-simulation/main.go +++ b/cmd/dexcon-simulation/main.go @@ -20,6 +20,7 @@ package main import ( "flag" "fmt" + "io" "log" "math/rand" "os" @@ -36,6 +37,7 @@ var configFile = flag.String("config", "", "path to simulation config file") var cpuprofile = flag.String("cpuprofile", "", "write cpu profile to `file`") var memprofile = flag.String("memprofile", "", "write memory profile to `file`") var legacy = flag.Bool("legacy", false, "legacy consensus protocal") +var logfile = flag.String("log", "", "write log to `file`") func main() { flag.Parse() @@ -66,6 +68,15 @@ func main() { defer pprof.StopCPUProfile() } + if *logfile != "" { + f, err := os.Create(*logfile) + if err != nil { + log.Fatal("could not create log file: ", err) + } + mw := io.MultiWriter(os.Stdout, f) + log.SetOutput(mw) + } + cfg, err := config.Read(*configFile) if err != nil { panic(err) |