diff --git a/atlan/client/asset.go b/atlan/client/asset.go index b9a4861..f369c16 100644 --- a/atlan/client/asset.go +++ b/atlan/client/asset.go @@ -756,7 +756,6 @@ func RetrieveMinimal(guid string) (*Assets2.Asset, error) { queryParams["min_ext_info"] = "true" queryParams["ignore_relationships"] = "true" - DefaultAtlanClient.logger.Debugf("Retrieving Asset with GUID: %s", guid) response, err := DefaultAtlanClient.CallAPI(api, queryParams, nil) if err != nil { return nil, err @@ -769,8 +768,6 @@ func RetrieveMinimal(guid string) (*Assets2.Asset, error) { return nil, fmt.Errorf("error unmarshalling asset response: %v", err) } - DefaultAtlanClient.logger.Debugf("Asset retrieved successfully with GUID: %s", guid) - api.Path = originalPath // Reset the api.Path to its original value return &assetresponse, nil } @@ -793,22 +790,16 @@ func PurgeByGuid(guids []string) (*model.AssetMutationResponse, error) { // Add the comma-separated string of GUIDs to the query parameters queryParams["guid"] = guidString - DefaultAtlanClient.logger.Debugf("Purging assets with GUIDs: %v", guids) - // Call the API resp, err := DefaultAtlanClient.CallAPI(api, queryParams, nil) if err != nil { - DefaultAtlanClient.logger.Errorf("Error purging assets: %v", err) return nil, err } - DefaultAtlanClient.logger.Debugf("Assets purged successfully") - // Unmarshal the response into the AssetMutationResponse struct var response model.AssetMutationResponse err = json.Unmarshal(resp, &response) if err != nil { - DefaultAtlanClient.logger.Errorf("Error unmarshalling response: %v", err) return nil, fmt.Errorf("error unmarshaling response: %v", err) } @@ -822,16 +813,13 @@ func DeleteByGuid(guids []string) (*model.AssetMutationResponse, error) { } for _, guid := range guids { - DefaultAtlanClient.logger.Debugf("Deleting asset with GUID: %s", guid) asset, err := RetrieveMinimal(guid) if err != nil { - DefaultAtlanClient.logger.Errorf("Error retrieving asset: %v", err) return nil, fmt.Errorf("error retrieving asset: %v", err) } // Assuming the asset has a CanBeArchived field that indicates if it can be archived if *asset.TypeName == "AtlasGlossaryCategory" { - DefaultAtlanClient.logger.Errorf("Asset %s of type %s cannot be archived", guid, *asset.TypeName) return nil, fmt.Errorf("asset %s of type %s cannot be archived", guid, *asset.TypeName) } } @@ -850,8 +838,6 @@ func DeleteByGuid(guids []string) (*model.AssetMutationResponse, error) { fmt.Println("Query Params:", queryParams) - DefaultAtlanClient.logger.Debugf("Soft deleting assets with GUIDs: %v", guids) - // Call the API resp, err := DefaultAtlanClient.CallAPI(api, queryParams, nil) if err != nil { @@ -859,13 +845,10 @@ func DeleteByGuid(guids []string) (*model.AssetMutationResponse, error) { return nil, err } - DefaultAtlanClient.logger.Debugf("Assets soft deleted successfully") - // Unmarshal the response into the AssetMutationResponse struct var response model.AssetMutationResponse err = json.Unmarshal(resp, &response) if err != nil { - DefaultAtlanClient.logger.Errorf("Error unmarshalling response: %v", err) return nil, fmt.Errorf("error unmarshaling response: %v", err) } @@ -873,7 +856,6 @@ func DeleteByGuid(guids []string) (*model.AssetMutationResponse, error) { for _, guid := range guids { err = WaitTillDeleted(guid) if err != nil { - DefaultAtlanClient.logger.Errorf("Error waiting for asset deletion: %v", err) return nil, err } } @@ -883,20 +865,16 @@ func DeleteByGuid(guids []string) (*model.AssetMutationResponse, error) { // WaitTillDeleted waits for an asset to be deleted. func WaitTillDeleted(guid string) error { - DefaultAtlanClient.logger.Debugf("Waiting for asset with GUID %s to be deleted", guid) for i := 0; i < MaxRetries; i++ { asset, err := RetrieveMinimal(guid) if err != nil { - DefaultAtlanClient.logger.Errorf("Error retrieving asset: %v", err) return fmt.Errorf("error retrieving asset: %v", err) } if *asset.Status == "DELETED" { - DefaultAtlanClient.logger.Debugf("Asset with GUID %s is deleted", guid) return nil } - DefaultAtlanClient.logger.Errorf("Retry limit overrun waiting for asset with GUID %s to be deleted", guid) // If the asset is not deleted, wait for a while before retrying time.Sleep(RetryInterval) } @@ -911,7 +889,6 @@ type SaveRequest struct { // Save saves the assets in memory to the Atlas server. func Save(assets ...AtlanObject) (*model.AssetMutationResponse, error) { - DefaultAtlanClient.logger.Debugf("Saving assets: %v", assets) request := SaveRequest{ Entities: assets, } @@ -922,12 +899,9 @@ func Save(assets ...AtlanObject) (*model.AssetMutationResponse, error) { return nil, err } - DefaultAtlanClient.logger.Debugf("Assets saved successfully") - var response model.AssetMutationResponse err = json.Unmarshal(resp, &response) if err != nil { - DefaultAtlanClient.logger.Errorf("Error unmarshalling response: %v", err) return nil, err } diff --git a/atlan/client/client.go b/atlan/client/client.go index 399f8a1..65fde59 100644 --- a/atlan/client/client.go +++ b/atlan/client/client.go @@ -176,7 +176,7 @@ func (ac *AtlanClient) CallAPI(api *API, queryParams map[string]string, requestO if requestObj != nil { //fmt.Println("Request Object:", requestObj) requestJSON, err := json.Marshal(requestObj) - //fmt.Println("Request JSON:", string(requestJSON)) + logger.Log.Debugf("Request JSON: %s", string(requestJSON)) if err != nil { ac.logger.Errorf("error marshaling request object: %v", err) return nil, fmt.Errorf("error marshaling request object: %v", err) @@ -287,14 +287,14 @@ func (ac *AtlanClient) makeRequest(method, path string, params map[string]interf } func (ac *AtlanClient) logAPICall(method, path string) { - ac.logger.Info("------------------------------------------------------") - ac.logger.Infof("Call : %s %s", method, path) - ac.logger.Infof("Content-type : application/json") - ac.logger.Infof("Accept : application/json") + ac.logger.Debugf("------------------------------------------------------") + ac.logger.Debugf("Call : %s %s", method, path) + ac.logger.Debugf("Content-type : application/json") + ac.logger.Debugf("Accept : application/json") } func (ac *AtlanClient) logHTTPStatus(response *http.Response) { - ac.logger.Infof("HTTP Status: %s", response.Status) + ac.logger.Debugf("HTTP Status: %s", response.Status) if response.StatusCode < 200 || response.StatusCode >= 300 { errorMessage, err := ioutil.ReadAll(response.Body) if err != nil { diff --git a/atlan/client/fluent_search.go b/atlan/client/fluent_search.go index 2b13373..e9ec2ea 100644 --- a/atlan/client/fluent_search.go +++ b/atlan/client/fluent_search.go @@ -3,7 +3,6 @@ package client import ( "fmt" "github.com/atlanhq/atlan-go/atlan" - "github.com/atlanhq/atlan-go/atlan/logger" "github.com/atlanhq/atlan-go/atlan/model" ) @@ -159,7 +158,6 @@ func (fs *FluentSearch) Execute() ([]*model.IndexSearchResponse, error) { } } - logger.Log.Debugf("Executed search successfully") return responses, nil }