-
Notifications
You must be signed in to change notification settings - Fork 27
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Remove use of defer
in printing logs
#87
Conversation
/invite @himanshu-kun |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the PR
the log changes are required only for nic, disk related operations. I have pointed which changes are not relevant.
pkg/azure/core.go
Outdated
|
||
// Check if provider in the MachineClass is the provider we support | ||
if req.MachineClass.Provider != ProviderAzure { | ||
err := fmt.Errorf("requested for Provider '%s', we only support '%s'", req.MachineClass.Provider, ProviderAzure) | ||
klog.V(2).Infof("Machine creation request failed for %q, Error: %v", req.Machine.Name, err) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think this defer
statement needs to be removed. as it says processed
not successful
or similar.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should I remove the failed request logs for all the other methods?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
addressed in d5d27b3
pkg/azure/core.go
Outdated
defer klog.V(2).Infof("Machine deletion request has been processed for %q", req.Machine.Name) | ||
klog.V(2).Infof("Machine deletion request has been received for %q", req.Machine.Name) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
same as above.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
addressed in d5d27b3
pkg/azure/core.go
Outdated
err := fillUpMachineClass(azureMachineClass, req.MachineClass) | ||
if err == nil { | ||
klog.V(2).Infof("MigrateMachineClass request has been processed successfully for %q", req.ClassSpec) | ||
} else { | ||
klog.V(2).Infof("MigrateMachineClass request has failed for %q, Error: %v", req.ClassSpec, err) | ||
} | ||
|
||
return &driver.GenerateMachineClassForMigrationResponse{}, err |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
we can revert this.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
addressed in d5d27b3
/needs cherry-pick on rel-v0.10 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
/lgtm
@himanshu-kun Labels needs/on, needs/rel-v0.10 do not exist. |
* remove use of defer in printing logs * address review comments * revert log to higher level
What this PR does / why we need it:
This PR removes the usage of the
defer
keyword when printing logs in some of the methods. Deferred logging leads to confusing logs, as the logged statement is incorrect when the corresponding method has to return an error.Which issue(s) this PR fixes:
Fixes #
Special notes for your reviewer:
Release note: