chore(logs): standardize application logging (#20731) #21442
+93
−88
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
I've tried implementing what was requested in #20731.
I moved the getAppLog function (that will return log.Fields when given an Application). From the application controller to the common utils. I'm not too sure if that's the right place for such a function so let me know if I should put it elsewhere.
I'm not sure I've found all the places where it could be used, but I searched through all usage of the
log.WithField(s)
methods and changed those that were logging application details.I only changed places where an Application struct was available, I saw that in some places we had different structs (such as ApplicationQuery) but I wasn't sure that it was in scope so I did not change it.
I have not written any test since I'm not introducing any new logic but if you think some tests are relevant, I'd be glad to implement them.
Fixes #20731
Checklist: