Skip to content
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

Process plog severity correctly from CLI11 flag #292

Merged
merged 1 commit into from
Jun 20, 2024

Conversation

abeltrano
Copy link
Contributor

@abeltrano abeltrano commented Jun 20, 2024

Type

  • Bug fix
  • Feature addition
  • Feature update
  • Documentation
  • Build Infrastructure

Side Effects

  • Breaking change
  • Non-functional change

Goals

  • Ensure errors are logged unconditionally.

Technical Details

CLI11 flag arguments, when bound to a variable of integral type, count the number of times the flag is specified. It was previously assumed that if the bound variable had a pre-seeded value (as we had done), that not specifying the flag would preserve the pre-seeded value. However, this is not the case and the value is reset to 0 to reflect the flag was not specified. This caused the default log level to have the value 0, which corresponds with the 'fatal' plog severity instead of the intended 'info' log severity. The following changes were made to fix this issue:

  • Introduce a default log verbosity value with value 'info' in NetRemoteServerConfiguration for consistent usage across the codebase.
  • Use and explicitly set the netremote-server log verbosity flag (-v) default value to the newly introduced default ('info').
  • Explicitly initialize NetRemoteServerConfiguration::LogVerbosity to the newly introduced default ('info').
  • Add log verbosity mapping table to NetRemoteServerConfiguration::LogVerbosity field comment.
  • Update LogVerbosityToPlogSeverity helper to prevent use of plog::none which will prevent any messages from being printed. There should never be any real use for this.
  • Print the log verbosity that netremote-server was configured with when it starts up.
  • Add debug print when netlink processing thread starts.
  • Drop log severity for netlink processing thread stop from info to debug.
  • Changed server start/stop messages to be printed unconditionally.

Test Results

  • Manually started the server binary with invalid address argument and no log verbosity argument and validated the log level was configured to be the new intended default of 'info' and that 'info', 'warning', and 'error' messages appeared in the console output (yellow output indicates warning log level, red indicates error log level):
image
  • Manually started the server binary with -vvvvv and validated the log level was configured to be 'verbose' and verbose messages appeared in the console output (green output indicates verbose log level):
image

Reviewer Focus

  • None

Future Work

Checklist

  • Build target all compiles cleanly.
  • clang-format and clang-tidy deltas produced no new output.
  • Newly added functions include doxygen-style comment block.

@abeltrano abeltrano requested a review from a team as a code owner June 20, 2024 20:42
@abeltrano abeltrano force-pushed the apilogerrorsnocond branch from f51cda8 to f560f3d Compare June 20, 2024 20:43
@abeltrano abeltrano merged commit e63c8c5 into develop Jun 20, 2024
5 checks passed
@abeltrano abeltrano deleted the apilogerrorsnocond branch June 20, 2024 21:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant