-
Notifications
You must be signed in to change notification settings - Fork 680
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
[generic-config-updater] Logging change just before applying it #1934
[generic-config-updater] Logging change just before applying it #1934
Conversation
if changes_len: | ||
self.logger.log_notice(f"Applying {changes_len} change{'s' if changes_len != 1 else ''} in order:") | ||
else: | ||
self.logger.log_notice(f"No changes to apply.") |
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.
To make it simple, how about
self.logger.log_notice(f"Applying {changes_len} change(s) in order:")
And no need to use if-else.
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 prefer log messages to be very informative even if they need a little extra code.
In case of 0, I prefer printing a clear message saying
No changes to apply.
In case of 1 change:
Applying 1 change in order:
In case of many changes:
Applying x changes in order:
I think this makes the logs easier to read.
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 can make it
self.logger.log_notice(f"Applying {changes_len} change{'s' if changes_len != 1 else ''} in order{':' if changes_len > 0 else '.'}")
less informative but not by much, but still easy to understand, and consistent with the previous list.
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.
updated
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.
Minor suggestion
c31a362 - 2021-11-18 : [202012][Mux orch] set default as standby, change mux orch priority (sonic-net#2015) [Prince Sunny] 9a9e8e6 - 2021-11-18 : [202012] Check VS test failure (sonic-net#2033) [Prince Sunny] 7eaabca - 2021-11-11 : [202012] Fix random failure in PR/CI build. (sonic-net#2016) [Shilong Liu] 85230fe - 2021-11-04 : [orchagent] Fix group name of port-buffer-drop in flexcounterorch.cpp (sonic-net#1967) [Junchao-Mellanox] a55c2ca - 2021-11-03 : [teammgrd]: Handle LAGs cleanup gracefully on Warm/Fast reboot. (sonic-net#1934) [Nazarii Hnydyn]
What I did
Logging a json change just before applying it. This help knowing at which step we failed change application.
How I did it
Added new log msg
Previous command output (if the output of a command-line utility has changed)
New command output (if the output of a command-line utility has changed)