Added --log-level option (#531)
This commit is contained in:
@@ -66,6 +66,9 @@ Some other features included:
|
|||||||
The path to a Kubernetes configuration file (env KUBE_CONFIG)
|
The path to a Kubernetes configuration file (env KUBE_CONFIG)
|
||||||
-kube-namespace string
|
-kube-namespace string
|
||||||
The namespace to watch or blank for all, which is the default (env KUBE_NAMESPACE)
|
The namespace to watch or blank for all, which is the default (env KUBE_NAMESPACE)
|
||||||
|
-log-level value
|
||||||
|
Set a specific log filtering level, such as debug, info, warn, error
|
||||||
|
Ignored when --debug or --trace is used (env LOG_LEVEL) (default info)
|
||||||
-mapping value
|
-mapping value
|
||||||
Comma or newline delimited or repeated mappings of externalHostname=host:port (env MAPPING)
|
Comma or newline delimited or repeated mappings of externalHostname=host:port (env MAPPING)
|
||||||
-metrics-backend string
|
-metrics-backend string
|
||||||
|
|||||||
@@ -27,6 +27,7 @@ type CliConfig struct {
|
|||||||
Version bool `usage:"Output version and exit"`
|
Version bool `usage:"Output version and exit"`
|
||||||
Debug bool `usage:"Enable debug logs"`
|
Debug bool `usage:"Enable debug logs"`
|
||||||
Trace bool `usage:"Enable trace logs"`
|
Trace bool `usage:"Enable trace logs"`
|
||||||
|
LogLevel logrus.Level `usage:"Set a specific log filtering level, such as debug, info, warn, error\nIgnored when --debug or --trace is used" default:"info"`
|
||||||
|
|
||||||
ServerConfig server.Config `flatten:"true"`
|
ServerConfig server.Config `flatten:"true"`
|
||||||
}
|
}
|
||||||
@@ -49,6 +50,8 @@ func main() {
|
|||||||
} else if cliConfig.Debug {
|
} else if cliConfig.Debug {
|
||||||
logrus.SetLevel(logrus.DebugLevel)
|
logrus.SetLevel(logrus.DebugLevel)
|
||||||
logrus.Debug("Debug logs enabled")
|
logrus.Debug("Debug logs enabled")
|
||||||
|
} else {
|
||||||
|
logrus.SetLevel(cliConfig.LogLevel)
|
||||||
}
|
}
|
||||||
|
|
||||||
ctx, stop := signal.NotifyContext(context.Background(), os.Interrupt)
|
ctx, stop := signal.NotifyContext(context.Background(), os.Interrupt)
|
||||||
|
|||||||
Reference in New Issue
Block a user