@@ -35,6 +35,7 @@ import (
3535 "github.com/jetstack/preflight/pkg/client"
3636 "github.com/jetstack/preflight/pkg/datagatherer"
3737 "github.com/jetstack/preflight/pkg/kubeconfig"
38+ "github.com/jetstack/preflight/pkg/logs"
3839 "github.com/jetstack/preflight/pkg/version"
3940)
4041
@@ -175,7 +176,7 @@ func Run(cmd *cobra.Command, args []string) (returnErr error) {
175176 return fmt .Errorf ("failed to instantiate %q data gatherer %q: %v" , kind , dgConfig .Name , err )
176177 }
177178
178- log .Info ("Starting DataGatherer" , "name" , dgConfig .Name )
179+ log .V ( logs . Debug ). Info ("Starting DataGatherer" , "name" , dgConfig .Name )
179180
180181 // start the data gatherers and wait for the cache sync
181182 group .Go (func () error {
@@ -285,7 +286,7 @@ func gatherAndOutputData(ctx context.Context, eventf Eventf, config CombinedConf
285286 var readings []* api.DataReading
286287
287288 if config .InputPath != "" {
288- log .Info ("Reading data from local file" , "inputPath" , config .InputPath )
289+ log .V ( logs . Debug ). Info ("Reading data from local file" , "inputPath" , config .InputPath )
289290 data , err := os .ReadFile (config .InputPath )
290291 if err != nil {
291292 return fmt .Errorf ("failed to read local data file: %s" , err )
@@ -351,7 +352,7 @@ func gatherData(ctx context.Context, config CombinedConfig, dataGatherers map[st
351352 if count >= 0 {
352353 log = log .WithValues ("count" , count )
353354 }
354- log .Info ("Successfully gathered" , "name" , k )
355+ log .V ( logs . Debug ). Info ("Successfully gathered" , "name" , k )
355356 }
356357 readings = append (readings , & api.DataReading {
357358 ClusterID : config .ClusterID ,
@@ -385,7 +386,7 @@ func postData(ctx context.Context, config CombinedConfig, preflightClient client
385386 log := klog .FromContext (ctx ).WithName ("postData" )
386387 baseURL := config .Server
387388
388- log .Info ("Posting data" , "baseURL" , baseURL )
389+ log .V ( logs . Debug ). Info ("Posting data" , "baseURL" , baseURL )
389390
390391 if config .AuthMode == VenafiCloudKeypair || config .AuthMode == VenafiCloudVenafiConnection {
391392 // orgID and clusterID are not required for Venafi Cloud auth
@@ -467,7 +468,7 @@ func postData(ctx context.Context, config CombinedConfig, preflightClient client
467468func listenAndServe (ctx context.Context , server * http.Server ) error {
468469 log := klog .FromContext (ctx ).WithName ("ListenAndServe" )
469470
470- log .V (1 ).Info ("Starting" )
471+ log .V (logs . Debug ).Info ("Starting" )
471472
472473 listenCTX , listenCancelCause := context .WithCancelCause (context .WithoutCancel (ctx ))
473474 go func () {
@@ -477,11 +478,11 @@ func listenAndServe(ctx context.Context, server *http.Server) error {
477478
478479 select {
479480 case <- listenCTX .Done ():
480- log .V (1 ).Info ("Shutdown skipped" , "reason" , "Server already stopped" )
481+ log .V (logs . Debug ).Info ("Shutdown skipped" , "reason" , "Server already stopped" )
481482 return context .Cause (listenCTX )
482483
483484 case <- ctx .Done ():
484- log .V (1 ).Info ("Shutting down" )
485+ log .V (logs . Debug ).Info ("Shutting down" )
485486 }
486487
487488 shutdownCTX , shutdownCancel := context .WithTimeout (context .WithoutCancel (ctx ), time .Second * 3 )
@@ -496,7 +497,7 @@ func listenAndServe(ctx context.Context, server *http.Server) error {
496497 closeErr = fmt .Errorf ("Close: %s" , closeErr )
497498 }
498499
499- log .V (1 ).Info ("Shutdown complete" )
500+ log .V (logs . Debug ).Info ("Shutdown complete" )
500501
501502 return errors .Join (shutdownErr , closeErr )
502503}
0 commit comments