debug flag

This commit is contained in:
NatureFreshMilk 2019-01-18 14:23:33 +01:00
parent 7a19cd3467
commit 11ebd96b9b
2 changed files with 8 additions and 2 deletions

View File

@ -13,12 +13,16 @@ import (
)
func main() {
logrus.SetLevel(logrus.InfoLevel)
//Parse command line
p := params.Parse()
if p.Debug {
logrus.SetLevel(logrus.DebugLevel)
} else {
logrus.SetLevel(logrus.InfoLevel)
}
if p.Help {
params.PrintHelp()
return

View File

@ -7,6 +7,7 @@ import (
type ParamsType struct {
Help bool
Version bool
Debug bool
Dumpconfig bool
}
@ -16,6 +17,7 @@ func Parse() ParamsType {
flag.BoolVar(&(params.Help), "help", false, "Show help")
flag.BoolVar(&(params.Version), "version", false, "Show version")
flag.BoolVar(&(params.Dumpconfig), "dumpconfig", false, "dump mapserver.json and exit")
flag.BoolVar(&(params.Debug), "debug", false, "enable debug log")
flag.Parse()
return params