diff options
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) |