adding new environmental variables for added debugging: COLLECTOR_LOG_FILE, COLLECTOR_DEBUG, DEBUG, SCRUTINY_LOG_FILE, SCRUTINY_DEBUG

This commit is contained in:
Jason Kulatunga
2020-09-21 18:41:52 -06:00
parent f2dd87cf82
commit a57120d600
9 changed files with 254 additions and 80 deletions
+21 -1
View File
@@ -95,10 +95,18 @@ OPTIONS:
if err != nil { // Handle errors reading the config file
//ignore "could not find config file"
fmt.Printf("Could not find config file at specified path: %s", c.String("config"))
os.Exit(1)
return err
}
}
if c.Bool("debug") {
config.Set("log.level", "DEBUG")
}
if c.IsSet("log-file") {
config.Set("log.file", c.String("log-file"))
}
webServer := web.AppEngine{Config: config}
return webServer.Start()
@@ -109,6 +117,18 @@ OPTIONS:
Name: "config",
Usage: "Specify the path to the config file",
},
&cli.StringFlag{
Name: "log-file",
Usage: "Path to file for logging. Leave empty to use STDOUT",
Value: "",
EnvVars: []string{"SCRUTINY_LOG_FILE"},
},
&cli.BoolFlag{
Name: "debug",
Usage: "Enable debug logging",
EnvVars: []string{"SCRUTINY_DEBUG", "DEBUG"},
},
},
},
},