Added --log-level option (#531)

This commit is contained in:
Geoff Bourne
2026-03-17 08:06:07 -05:00
committed by GitHub
parent 5c7f5d7b36
commit b6e6114c56
2 changed files with 9 additions and 3 deletions
+3
View File
@@ -66,6 +66,9 @@ Some other features included:
The path to a Kubernetes configuration file (env KUBE_CONFIG)
-kube-namespace string
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
Comma or newline delimited or repeated mappings of externalHostname=host:port (env MAPPING)
-metrics-backend string
+6 -3
View File
@@ -24,9 +24,10 @@ func showVersion() {
}
type CliConfig struct {
Version bool `usage:"Output version and exit"`
Debug bool `usage:"Enable debug logs"`
Trace bool `usage:"Enable trace logs"`
Version bool `usage:"Output version and exit"`
Debug bool `usage:"Enable debug 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"`
}
@@ -49,6 +50,8 @@ func main() {
} else if cliConfig.Debug {
logrus.SetLevel(logrus.DebugLevel)
logrus.Debug("Debug logs enabled")
} else {
logrus.SetLevel(cliConfig.LogLevel)
}
ctx, stop := signal.NotifyContext(context.Background(), os.Interrupt)