aboutsummaryrefslogtreecommitdiff
path: root/cmd
diff options
context:
space:
mode:
Diffstat (limited to 'cmd')
-rw-r--r--cmd/silent-ctmoon/main.go9
1 files changed, 8 insertions, 1 deletions
diff --git a/cmd/silent-ctmoon/main.go b/cmd/silent-ctmoon/main.go
index 436ea64..823b1c7 100644
--- a/cmd/silent-ctmoon/main.go
+++ b/cmd/silent-ctmoon/main.go
@@ -91,10 +91,17 @@ func configure(cmd string, args []string) (cfg config, err error) {
if cfg.policyFile == "" {
return cfg, fmt.Errorf("policy file is a required option")
}
+ output := os.Stdout
+ if cfg.outputFile != "" {
+ if output, err = os.OpenFile(cfg.outputFile, os.O_WRONLY|os.O_CREATE|os.O_APPEND, 0644); err != nil {
+ return cfg, fmt.Errorf("failed to open output file: %v", err)
+ }
+ }
if cfg.numWorkers == 0 || cfg.numWorkers > 4 {
return cfg, fmt.Errorf("number of workers must be in [1, 4]")
}
- cfg.log = logger.New(logger.Config{Level: lv, File: os.Stdout})
+
+ cfg.log = logger.New(logger.Config{Level: lv, File: output})
if err := ioutil.ReadJSON(cfg.policyFile, &cfg.policy); err != nil {
return cfg, err
}