|
4 | 4 | "context" |
5 | 5 | "errors" |
6 | 6 | "fmt" |
| 7 | + "log/slog" |
7 | 8 | "os" |
8 | 9 | "regexp" |
9 | 10 | "strconv" |
@@ -79,12 +80,13 @@ var RootCmd = &cobra.Command{ |
79 | 80 | func init() { |
80 | 81 | RootCmd.PersistentFlags().IntVarP(&numRetries, "retries", "r", DefaultNumRetries, "For SSM or Secrets Manager, the number of retries we'll make before giving up; AKA $CHAMBER_RETRIES") |
81 | 82 | RootCmd.PersistentFlags().DurationVarP(&minThrottleDelay, "min-throttle-delay", "", 0, "DEPRECATED and no longer has any effect. Use retry-mode instead") |
| 83 | + _ = RootCmd.PersistentFlags().MarkDeprecated("min-throttle-delay", "use --retry-mode instead") |
82 | 84 | RootCmd.PersistentFlags().StringVarP(&retryMode, "retry-mode", "", store.DefaultRetryMode.String(), |
83 | 85 | `For SSM, the model used to retry requests |
84 | 86 | `+aws.RetryModeStandard.String()+` |
85 | 87 | `+aws.RetryModeAdaptive.String(), |
86 | 88 | ) |
87 | | - RootCmd.PersistentFlags().BoolVarP(&verbose, "verbose", "", false, "Print more information to STDOUT") |
| 89 | + RootCmd.PersistentFlags().BoolVarP(&verbose, "verbose", "", false, "Print more information to STDERR") |
88 | 90 | RootCmd.PersistentFlags().StringVarP(&backendFlag, "backend", "b", "ssm", |
89 | 91 | `Backend to use; AKA $CHAMBER_SECRET_BACKEND |
90 | 92 | null: no-op |
@@ -250,6 +252,13 @@ func prerun(cmd *cobra.Command, args []string) { |
250 | 252 | Set("chamber-version", chamberVersion), |
251 | 253 | }) |
252 | 254 | } |
| 255 | + |
| 256 | + if verbose { |
| 257 | + levelVar := &slog.LevelVar{} |
| 258 | + levelVar.Set(slog.LevelDebug) |
| 259 | + handler := slog.NewTextHandler(os.Stderr, &slog.HandlerOptions{Level: levelVar}) |
| 260 | + slog.SetDefault(slog.New(handler)) |
| 261 | + } |
253 | 262 | } |
254 | 263 |
|
255 | 264 | func postrun(cmd *cobra.Command, args []string) { |
|
0 commit comments