@@ -35,6 +35,7 @@ import (
35
35
"github.com/jetstack/preflight/pkg/client"
36
36
"github.com/jetstack/preflight/pkg/datagatherer"
37
37
"github.com/jetstack/preflight/pkg/kubeconfig"
38
+ "github.com/jetstack/preflight/pkg/logs"
38
39
"github.com/jetstack/preflight/pkg/version"
39
40
)
40
41
@@ -175,7 +176,7 @@ func Run(cmd *cobra.Command, args []string) (returnErr error) {
175
176
return fmt .Errorf ("failed to instantiate %q data gatherer %q: %v" , kind , dgConfig .Name , err )
176
177
}
177
178
178
- log .Info ("Starting DataGatherer" , "name" , dgConfig .Name )
179
+ log .V ( logs . Debug ). Info ("Starting DataGatherer" , "name" , dgConfig .Name )
179
180
180
181
// start the data gatherers and wait for the cache sync
181
182
group .Go (func () error {
@@ -285,7 +286,7 @@ func gatherAndOutputData(ctx context.Context, eventf Eventf, config CombinedConf
285
286
var readings []* api.DataReading
286
287
287
288
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 )
289
290
data , err := os .ReadFile (config .InputPath )
290
291
if err != nil {
291
292
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
351
352
if count >= 0 {
352
353
log = log .WithValues ("count" , count )
353
354
}
354
- log .Info ("Successfully gathered" , "name" , k )
355
+ log .V ( logs . Debug ). Info ("Successfully gathered" , "name" , k )
355
356
}
356
357
readings = append (readings , & api.DataReading {
357
358
ClusterID : config .ClusterID ,
@@ -385,7 +386,7 @@ func postData(ctx context.Context, config CombinedConfig, preflightClient client
385
386
log := klog .FromContext (ctx ).WithName ("postData" )
386
387
baseURL := config .Server
387
388
388
- log .Info ("Posting data" , "baseURL" , baseURL )
389
+ log .V ( logs . Debug ). Info ("Posting data" , "baseURL" , baseURL )
389
390
390
391
if config .AuthMode == VenafiCloudKeypair || config .AuthMode == VenafiCloudVenafiConnection {
391
392
// orgID and clusterID are not required for Venafi Cloud auth
@@ -467,7 +468,7 @@ func postData(ctx context.Context, config CombinedConfig, preflightClient client
467
468
func listenAndServe (ctx context.Context , server * http.Server ) error {
468
469
log := klog .FromContext (ctx ).WithName ("ListenAndServe" )
469
470
470
- log .V (1 ).Info ("Starting" )
471
+ log .V (logs . Debug ).Info ("Starting" )
471
472
472
473
listenCTX , listenCancelCause := context .WithCancelCause (context .WithoutCancel (ctx ))
473
474
go func () {
@@ -477,11 +478,11 @@ func listenAndServe(ctx context.Context, server *http.Server) error {
477
478
478
479
select {
479
480
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" )
481
482
return context .Cause (listenCTX )
482
483
483
484
case <- ctx .Done ():
484
- log .V (1 ).Info ("Shutting down" )
485
+ log .V (logs . Debug ).Info ("Shutting down" )
485
486
}
486
487
487
488
shutdownCTX , shutdownCancel := context .WithTimeout (context .WithoutCancel (ctx ), time .Second * 3 )
@@ -496,7 +497,7 @@ func listenAndServe(ctx context.Context, server *http.Server) error {
496
497
closeErr = fmt .Errorf ("Close: %s" , closeErr )
497
498
}
498
499
499
- log .V (1 ).Info ("Shutdown complete" )
500
+ log .V (logs . Debug ).Info ("Shutdown complete" )
500
501
501
502
return errors .Join (shutdownErr , closeErr )
502
503
}
0 commit comments