Skip to content

Commit

Permalink
use cns logger lib (#3142)
Browse files Browse the repository at this point in the history
* use cns logger lib

* use cns logger lib

* fix linter issues

* add [Azure CNS]

* remove [Azure CNS] log
  • Loading branch information
paulyufan2 authored Nov 21, 2024
1 parent b30cdc3 commit bf080b9
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions cns/service/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -365,9 +365,9 @@ func init() {
// Wait until receiving a signal.
select {
case sig := <-sigCh:
log.Errorf("caught exit signal %v, exiting", sig)
logger.Errorf("caught exit signal %v, exiting", sig)
case err := <-rootErrCh:
log.Errorf("unhandled error %v, exiting", err)
logger.Errorf("unhandled error %v, exiting", err)
}
cancel()
}()
Expand Down Expand Up @@ -428,7 +428,7 @@ func sendRegisterNodeRequest(ctx context.Context, httpClient httpDoer, httpRestS
var body bytes.Buffer
err := json.NewEncoder(&body).Encode(nodeRegisterRequest)
if err != nil {
log.Errorf("[Azure CNS] Failed to register node while encoding json failed with non-retryable err %v", err)
logger.Errorf("Failed to register node while encoding json failed with non-retryable err %v", err)
return errors.Wrap(retry.Unrecoverable(err), "failed to sendRegisterNodeRequest")
}

Expand All @@ -454,7 +454,7 @@ func sendRegisterNodeRequest(ctx context.Context, httpClient httpDoer, httpRestS
var req cns.SetOrchestratorTypeRequest
err = json.NewDecoder(response.Body).Decode(&req)
if err != nil {
log.Errorf("[Azure CNS] decoding Node Register response json failed with err %v", err)
logger.Errorf("decoding Node Register response json failed with err %v", err)
return errors.Wrap(err, "failed to sendRegisterNodeRequest")
}
httpRestService.SetNodeOrchestrator(&req)
Expand All @@ -469,7 +469,7 @@ func startTelemetryService(ctx context.Context) {
tb := telemetry.NewTelemetryBuffer(nil)
err := tb.CreateAITelemetryHandle(config, false, false, false)
if err != nil {
log.Errorf("AI telemetry handle creation failed..:%w", err)
logger.Errorf("AI telemetry handle creation failed: %v", err)
return
}

Expand All @@ -478,9 +478,9 @@ func startTelemetryService(ctx context.Context) {
tbtemp.Cleanup(telemetry.FdName)

err = tb.StartServer()
log.Printf("Telemetry service for CNI started")
logger.Printf("Telemetry service for CNI started")
if err != nil {
log.Errorf("Telemetry service failed to start: %w", err)
logger.Errorf("Telemetry service failed to start: %v", err)
return
}
tb.PushData(ctx)
Expand Down Expand Up @@ -1484,7 +1484,7 @@ func InitializeCRDState(ctx context.Context, httpRestService cns.HTTPService, cn
// this false and the NNC Reconciler stuck/failed, log and retry.
nncReadyCtx, cancel := context.WithTimeout(ctx, 15*time.Minute) //nolint // it will time out and not leak
if started, err := nncReconciler.Started(nncReadyCtx); !started {
log.Errorf("NNC reconciler has not started, does the NNC exist? err: %v", err)
logger.Errorf("NNC reconciler has not started, does the NNC exist? err: %v", err)
nncReconcilerStartFailures.Inc()
continue
}
Expand Down

0 comments on commit bf080b9

Please sign in to comment.