diff --git a/README.md b/README.md index cd27696..294a624 100644 --- a/README.md +++ b/README.md @@ -67,6 +67,7 @@ GLOBAL OPTIONS: --chain-id value to ensure all nodes matches the specific network (dismiss to auto-detected) --http-addr value http server address (default: ":8080") --log-level value log level (debug, info, warn, error) (default: "info") + --debug shortcut for --log-level=debug (default: false) --namespace value namespace for Prometheus metrics (default: "cosmos_validator_watcher") --no-color disable colored output (default: false) --node value [ --node value ] rpc node endpoint to connect to (specify multiple for high availability) (default: "http://localhost:26657") diff --git a/pkg/app/flags.go b/pkg/app/flags.go index 67705a7..768dc2f 100644 --- a/pkg/app/flags.go +++ b/pkg/app/flags.go @@ -21,6 +21,10 @@ var Flags = []cli.Flag{ Usage: "log level (debug, info, warn, error)", Value: "info", }, + &cli.BoolFlag{ + Name: "debug", + Usage: "shortcut for --log-level=debug", + }, &cli.StringFlag{ Name: "namespace", Usage: "namespace for Prometheus metrics", diff --git a/pkg/app/run.go b/pkg/app/run.go index 0ee2278..afe3b1a 100644 --- a/pkg/app/run.go +++ b/pkg/app/run.go @@ -34,6 +34,7 @@ func RunFunc(cCtx *cli.Context) error { // Config flags chainID = cCtx.String("chain-id") + debug = cCtx.Bool("debug") httpAddr = cCtx.String("http-addr") logLevel = cCtx.String("log-level") namespace = cCtx.String("namespace") @@ -61,6 +62,9 @@ func RunFunc(cCtx *cli.Context) error { zerolog.TimeFieldFormat = zerolog.TimeFormatUnix log.Logger = log.Output(zerolog.ConsoleWriter{Out: os.Stderr}) zerolog.SetGlobalLevel(logLevelFromString(logLevel)) + if debug { + zerolog.SetGlobalLevel(zerolog.DebugLevel) + } // Disable colored output if requested color.NoColor = noColor