Skip to content

Commit 321aabb

Browse files
committed
use cns logger lib
1 parent 1b5d3a1 commit 321aabb

File tree

1 file changed

+8
-9
lines changed

1 file changed

+8
-9
lines changed

cns/service/main.go

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,6 @@ import (
5757
"github.com/Azure/azure-container-networking/crd/nodenetworkconfig"
5858
"github.com/Azure/azure-container-networking/crd/nodenetworkconfig/api/v1alpha"
5959
acnfs "github.com/Azure/azure-container-networking/internal/fs"
60-
"github.com/Azure/azure-container-networking/log"
6160
"github.com/Azure/azure-container-networking/nmagent"
6261
"github.com/Azure/azure-container-networking/platform"
6362
"github.com/Azure/azure-container-networking/processlock"
@@ -365,9 +364,9 @@ func init() {
365364
// Wait until receiving a signal.
366365
select {
367366
case sig := <-sigCh:
368-
log.Errorf("caught exit signal %v, exiting", sig)
367+
logger.Errorf("caught exit signal %v, exiting", sig)
369368
case err := <-rootErrCh:
370-
log.Errorf("unhandled error %v, exiting", err)
369+
logger.Errorf("unhandled error %v, exiting", err)
371370
}
372371
cancel()
373372
}()
@@ -428,7 +427,7 @@ func sendRegisterNodeRequest(ctx context.Context, httpClient httpDoer, httpRestS
428427
var body bytes.Buffer
429428
err := json.NewEncoder(&body).Encode(nodeRegisterRequest)
430429
if err != nil {
431-
log.Errorf("[Azure CNS] Failed to register node while encoding json failed with non-retryable err %v", err)
430+
logger.Errorf("[Azure CNS] Failed to register node while encoding json failed with non-retryable err %v", err)
432431
return errors.Wrap(retry.Unrecoverable(err), "failed to sendRegisterNodeRequest")
433432
}
434433

@@ -454,7 +453,7 @@ func sendRegisterNodeRequest(ctx context.Context, httpClient httpDoer, httpRestS
454453
var req cns.SetOrchestratorTypeRequest
455454
err = json.NewDecoder(response.Body).Decode(&req)
456455
if err != nil {
457-
log.Errorf("[Azure CNS] decoding Node Register response json failed with err %v", err)
456+
logger.Errorf("[Azure CNS] decoding Node Register response json failed with err %v", err)
458457
return errors.Wrap(err, "failed to sendRegisterNodeRequest")
459458
}
460459
httpRestService.SetNodeOrchestrator(&req)
@@ -469,7 +468,7 @@ func startTelemetryService(ctx context.Context) {
469468
tb := telemetry.NewTelemetryBuffer(nil)
470469
err := tb.CreateAITelemetryHandle(config, false, false, false)
471470
if err != nil {
472-
log.Errorf("AI telemetry handle creation failed..:%w", err)
471+
logger.Errorf("AI telemetry handle creation failed..:%w", err)
473472
return
474473
}
475474

@@ -478,9 +477,9 @@ func startTelemetryService(ctx context.Context) {
478477
tbtemp.Cleanup(telemetry.FdName)
479478

480479
err = tb.StartServer()
481-
log.Printf("Telemetry service for CNI started")
480+
logger.Printf("Telemetry service for CNI started")
482481
if err != nil {
483-
log.Errorf("Telemetry service failed to start: %w", err)
482+
logger.Errorf("Telemetry service failed to start: %w", err)
484483
return
485484
}
486485
tb.PushData(ctx)
@@ -1482,7 +1481,7 @@ func InitializeCRDState(ctx context.Context, httpRestService cns.HTTPService, cn
14821481
// this false and the NNC Reconciler stuck/failed, log and retry.
14831482
nncReadyCtx, cancel := context.WithTimeout(ctx, 15*time.Minute) //nolint // it will time out and not leak
14841483
if started, err := nncReconciler.Started(nncReadyCtx); !started {
1485-
log.Errorf("NNC reconciler has not started, does the NNC exist? err: %v", err)
1484+
logger.Errorf("NNC reconciler has not started, does the NNC exist? err: %v", err)
14861485
nncReconcilerStartFailures.Inc()
14871486
continue
14881487
}

0 commit comments

Comments
 (0)