Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add shortcut for log-level=debug #87

Merged
merged 1 commit into from
Nov 16, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Expand Down
4 changes: 4 additions & 0 deletions pkg/app/flags.go
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
4 changes: 4 additions & 0 deletions pkg/app/run.go
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Expand Down Expand Up @@ -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
Expand Down
Loading