From b3f7194c9ac1dd76065d0c08d3063b447759c54f Mon Sep 17 00:00:00 2001 From: Tamilmani Manoharan Date: Tue, 28 Jan 2020 10:01:04 -0800 Subject: [PATCH] fixed cnsclient log --- cns/cnsclient/cnsclient.go | 38 +++++++++++++++++++------------------- 1 file changed, 19 insertions(+), 19 deletions(-) diff --git a/cns/cnsclient/cnsclient.go b/cns/cnsclient/cnsclient.go index 151c975924..613b226fd9 100644 --- a/cns/cnsclient/cnsclient.go +++ b/cns/cnsclient/cnsclient.go @@ -7,7 +7,7 @@ import ( "net/http" "github.com/Azure/azure-container-networking/cns" - "github.com/Azure/azure-container-networking/cns/logger" + "github.com/Azure/azure-container-networking/log" ) // CNSClient specifies a client to connect to Ipam Plugin. @@ -55,7 +55,7 @@ func (cnsClient *CNSClient) GetNetworkConfiguration(orchestratorContext []byte) httpc := &http.Client{} url := cnsClient.connectionURL + cns.GetNetworkContainerByOrchestratorContext - logger.Printf("GetNetworkConfiguration url %v", url) + log.Printf("GetNetworkConfiguration url %v", url) payload := &cns.GetNetworkContainerRequest{ OrchestratorContext: orchestratorContext, @@ -63,13 +63,13 @@ func (cnsClient *CNSClient) GetNetworkConfiguration(orchestratorContext []byte) err := json.NewEncoder(&body).Encode(payload) if err != nil { - logger.Errorf("encoding json failed with %v", err) + log.Errorf("encoding json failed with %v", err) return nil, err } res, err := httpc.Post(url, "application/json", &body) if err != nil { - logger.Errorf("[Azure CNSClient] HTTP Post returned error %v", err.Error()) + log.Errorf("[Azure CNSClient] HTTP Post returned error %v", err.Error()) return nil, err } @@ -77,7 +77,7 @@ func (cnsClient *CNSClient) GetNetworkConfiguration(orchestratorContext []byte) if res.StatusCode != http.StatusOK { errMsg := fmt.Sprintf("[Azure CNSClient] GetNetworkConfiguration invalid http status code: %v", res.StatusCode) - logger.Errorf(errMsg) + log.Errorf(errMsg) return nil, fmt.Errorf(errMsg) } @@ -85,12 +85,12 @@ func (cnsClient *CNSClient) GetNetworkConfiguration(orchestratorContext []byte) err = json.NewDecoder(res.Body).Decode(&resp) if err != nil { - logger.Errorf("[Azure CNSClient] Error received while parsing GetNetworkConfiguration response resp:%v err:%v", res.Body, err.Error()) + log.Errorf("[Azure CNSClient] Error received while parsing GetNetworkConfiguration response resp:%v err:%v", res.Body, err.Error()) return nil, err } if resp.Response.ReturnCode != 0 { - logger.Errorf("[Azure CNSClient] GetNetworkConfiguration received error response :%v", resp.Response.Message) + log.Errorf("[Azure CNSClient] GetNetworkConfiguration received error response :%v", resp.Response.Message) return nil, fmt.Errorf(resp.Response.Message) } @@ -107,20 +107,20 @@ func (cnsClient *CNSClient) CreateHostNCApipaEndpoint( httpc := &http.Client{} url := cnsClient.connectionURL + cns.CreateHostNCApipaEndpointPath - logger.Printf("CreateHostNCApipaEndpoint url: %v for NC: %s", url, networkContainerID) + log.Printf("CreateHostNCApipaEndpoint url: %v for NC: %s", url, networkContainerID) payload := &cns.CreateHostNCApipaEndpointRequest{ NetworkContainerID: networkContainerID, } if err = json.NewEncoder(&body).Encode(payload); err != nil { - logger.Errorf("encoding json failed with %v", err) + log.Errorf("encoding json failed with %v", err) return "", err } res, err := httpc.Post(url, "application/json", &body) if err != nil { - logger.Errorf("[Azure CNSClient] HTTP Post returned error %v", err.Error()) + log.Errorf("[Azure CNSClient] HTTP Post returned error %v", err.Error()) return "", err } @@ -129,20 +129,20 @@ func (cnsClient *CNSClient) CreateHostNCApipaEndpoint( if res.StatusCode != http.StatusOK { errMsg := fmt.Sprintf("[Azure CNSClient] CreateHostNCApipaEndpoint: Invalid http status code: %v", res.StatusCode) - logger.Errorf(errMsg) + log.Errorf(errMsg) return "", fmt.Errorf(errMsg) } var resp cns.CreateHostNCApipaEndpointResponse if err = json.NewDecoder(res.Body).Decode(&resp); err != nil { - logger.Errorf("[Azure CNSClient] Error parsing CreateHostNCApipaEndpoint response resp: %v err: %v", + log.Errorf("[Azure CNSClient] Error parsing CreateHostNCApipaEndpoint response resp: %v err: %v", res.Body, err.Error()) return "", err } if resp.Response.ReturnCode != 0 { - logger.Errorf("[Azure CNSClient] CreateHostNCApipaEndpoint received error response :%v", resp.Response.Message) + log.Errorf("[Azure CNSClient] CreateHostNCApipaEndpoint received error response :%v", resp.Response.Message) return "", fmt.Errorf(resp.Response.Message) } @@ -155,7 +155,7 @@ func (cnsClient *CNSClient) DeleteHostNCApipaEndpoint(networkContainerID string) httpc := &http.Client{} url := cnsClient.connectionURL + cns.DeleteHostNCApipaEndpointPath - logger.Printf("DeleteHostNCApipaEndpoint url: %v for NC: %s", url, networkContainerID) + log.Printf("DeleteHostNCApipaEndpoint url: %v for NC: %s", url, networkContainerID) payload := &cns.DeleteHostNCApipaEndpointRequest{ NetworkContainerID: networkContainerID, @@ -163,13 +163,13 @@ func (cnsClient *CNSClient) DeleteHostNCApipaEndpoint(networkContainerID string) err := json.NewEncoder(&body).Encode(payload) if err != nil { - logger.Errorf("encoding json failed with %v", err) + log.Errorf("encoding json failed with %v", err) return err } res, err := httpc.Post(url, "application/json", &body) if err != nil { - logger.Errorf("[Azure CNSClient] HTTP Post returned error %v", err.Error()) + log.Errorf("[Azure CNSClient] HTTP Post returned error %v", err.Error()) return err } @@ -178,7 +178,7 @@ func (cnsClient *CNSClient) DeleteHostNCApipaEndpoint(networkContainerID string) if res.StatusCode != http.StatusOK { errMsg := fmt.Sprintf("[Azure CNSClient] DeleteHostNCApipaEndpoint: Invalid http status code: %v", res.StatusCode) - logger.Errorf(errMsg) + log.Errorf(errMsg) return fmt.Errorf(errMsg) } @@ -186,13 +186,13 @@ func (cnsClient *CNSClient) DeleteHostNCApipaEndpoint(networkContainerID string) err = json.NewDecoder(res.Body).Decode(&resp) if err != nil { - logger.Errorf("[Azure CNSClient] Error parsing DeleteHostNCApipaEndpoint response resp: %v err: %v", + log.Errorf("[Azure CNSClient] Error parsing DeleteHostNCApipaEndpoint response resp: %v err: %v", res.Body, err.Error()) return err } if resp.Response.ReturnCode != 0 { - logger.Errorf("[Azure CNSClient] DeleteHostNCApipaEndpoint received error response :%v", resp.Response.Message) + log.Errorf("[Azure CNSClient] DeleteHostNCApipaEndpoint received error response :%v", resp.Response.Message) return fmt.Errorf(resp.Response.Message) }