Skip to content

Conversation

@harryswift01
Copy link
Contributor

Summary

This PR addresses the issue where setting the verbose flag to True in the YAML configuration does not set the logging system to DEBUG mode. The changes ensure that the verbose flag from the YAML input is correctly merged and applied, and that DEBUG level messages are directed to file handlers while the console handler remains at INFO level.

Changes

Updated merge_configs method to explicitly handle the verbose flag from YAML configuration:

  • Ensured the verbose flag from the YAML configuration is correctly merged with CLI arguments.
  • Added logic to explicitly set the verbose flag in the merged configuration.

Added update_logging_level method to LoggingConfig class to update logging levels for all loggers and handlers

  • Created a new method update_logging_level to update the logging level for all loggers and handlers.
  • Ensured DEBUG level messages are directed to file handlers while console handler remains at INFO level.

Modified main function to use the new method for updating logging levels

  • Updated the main function to initialize the logging system once and use the update_logging_level method to set the logging level for each run configuration.
  • Ensured the logging level is correctly set based on the final merged configuration.

Updated the input YAML file template to make sure they correctly match up to the arguments in argparse

  • Ensured the YAML file template includes all necessary arguments and correctly matches the argparse setup.

Impact

  • Ensures DEBUG level messages are correctly logged to file handlers when verbose is set to True in the YAML configuration.
  • Improves the merging of CLI arguments and YAML configuration, ensuring the verbose flag is correctly applied.
  • Streamlines the logging configuration process by updating logging levels without reinitializing the logging system.
  • Enhances the input YAML file template to ensure all arguments are correctly matched and handled.

- Updated `merge_configs` method to explicitly handle the `verbose` flag from YAML configuration
- Added `update_logging_level` method to `LoggingConfig` class to update logging levels for all loggers and handlers
- Modified `main` function to use the new method for updating logging levels
- Ensured `DEBUG` level messages are directed to file handlers while console handler remains at `INFO` level
- Updated the input YAML file template to make sure they correctly match up to the arguments in argsparse
@harryswift01 harryswift01 added the bug Something isn't working label Apr 7, 2025
@harryswift01 harryswift01 added this to the WP4 - Input/Output milestone Apr 7, 2025
@harryswift01 harryswift01 requested a review from jimboid April 7, 2025 15:51
@harryswift01 harryswift01 self-assigned this Apr 7, 2025
@harryswift01 harryswift01 linked an issue Apr 7, 2025 that may be closed by this pull request
Copy link
Member

@jimboid jimboid left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks like it has resolved the issue with logging levels being incorrectly set when done by yaml.

Looking at the config there are some mixed formatting on var names, but we can discuss this tomorrow without blocking this PR. Happy to merge.

harryswift01 and others added 2 commits April 8, 2025 09:55
- Updated `waterEntropy` to `water_entropy`
- Updated `mout` to `matrix_out`
- Updated `outfile` to `output_file`
- Ensured that any instance of any of these arguments have been changed throughout the codebase to match
- Updated some of the test cases so that they match the new arguments names and made sure they have the correct file format to maintain consistency
@harryswift01 harryswift01 force-pushed the 81-verbose-YAML-bug branch from 0fe837d to 0e4b6c0 Compare April 8, 2025 08:55
@harryswift01 harryswift01 merged commit 54446d2 into main Apr 8, 2025
5 checks passed
@harryswift01 harryswift01 deleted the 81-verbose-YAML-bug branch April 8, 2025 12:59
@jimboid jimboid modified the milestones: WP4 - Input/Output, 1.0.0 release Jun 10, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Verbose not being set on YAML input correctly

4 participants