From 12d2fbe6e351fbe1ceb7c8c30b1b528722f5db3f Mon Sep 17 00:00:00 2001 From: Peidong Lu Date: Wed, 10 Apr 2024 11:10:29 +0800 Subject: [PATCH] pretify moc version message (#271) --- cloud/services/versions/versions.go | 2 +- cloud/telemetry/logutils.go | 9 ++------- 2 files changed, 3 insertions(+), 8 deletions(-) diff --git a/cloud/services/versions/versions.go b/cloud/services/versions/versions.go index 28b76c76..b083ad5d 100644 --- a/cloud/services/versions/versions.go +++ b/cloud/services/versions/versions.go @@ -32,7 +32,7 @@ type VersionPair struct { func (s *Service) Get(ctx context.Context) (*VersionPair, error) { version, mocversion, err := s.Client.GetVersion(ctx) if err != nil { - s.Scope.GetLogger().Error(err, "Unable to get moc deployment id") + s.Scope.GetLogger().Error(err, "Unable to get moc version") return nil, err } return &VersionPair{ diff --git a/cloud/telemetry/logutils.go b/cloud/telemetry/logutils.go index dc28175b..87194aca 100644 --- a/cloud/telemetry/logutils.go +++ b/cloud/telemetry/logutils.go @@ -2,7 +2,6 @@ package telemetry import ( "context" - "encoding/json" "fmt" "strings" "time" @@ -130,12 +129,8 @@ func WriteMocInfoLog(ctx context.Context, scope scope.ScopeInterface) { WssdCloudAgentVersion: wssdCloudAgentVersion, MocVersion: mocVersion, } - jsonData, err := json.Marshal(infoLog) - if err != nil { - logger.Error(err, "Unable to serialize moc info log object.") - } else { - logger.Info(string(jsonData)) - } + + logger.Info("Record Moc Info", "mocInfo", infoLog) } func getVersionsService(scope scope.ScopeInterface) *versions.Service {