Skip to content

Commit 7ad7643

Browse files
Add verbose mode flag for detailed logging
Added a verbose mode flag to enable detailed logging.
1 parent 36220f7 commit 7ad7643

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

pkg/cmd/root/root.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -85,6 +85,7 @@ func init() {
8585
//rootCmd.PersistentFlags().StringVar(&kubeconfig, "kubeconfig", "", "kubeconfig file (default is $HOME/.kube/config")
8686
rootCmd.PersistentFlags().BoolVar(&config2.SkipSSLVerify, "skipSSL", false, "skipSSL, litmusctl will skip ssl/tls verification while communicating with portal")
8787
rootCmd.PersistentFlags().StringVar(&config2.CACert, "cacert", "", "cacert <path_to_crt_file> , custom ca certificate used for communicating with portal")
88+
rootCmd.PersistentFlags().BoolVarP(&config2.VerboseMode, "verbose", "v", false, "enable verbose logging (shows request payloads, API endpoints, and additional details)")
8889
}
8990

9091
// initConfig reads in config file and ENV variables if set.
@@ -104,6 +105,9 @@ func initConfig() {
104105

105106
viper.AutomaticEnv() // read in environment variables that match
106107

108+
// Configure verbose logging based on the flag
109+
utils.ConfigureVerboseLogging()
110+
107111
if config2.SkipSSLVerify {
108112
http.DefaultTransport.(*http.Transport).TLSClientConfig = &tls.Config{InsecureSkipVerify: true}
109113
} else if config2.CACert != "" {

0 commit comments

Comments
 (0)