Skip to content

Conversation

@harryswift01
Copy link
Contributor

Summary

This PR introduces a custom Python logging system into CodeEntropy with the aim of simplifying and unifying the logging process, improving the clarity of logs, and enhancing the ability to troubleshoot issues. It also includes several structural and functional improvements related to data logging and configuration management.

Changes

Introduction of Logging System:

  • Created a new logging_config.py file to manage logging configurations and cases.
  • The new logging system produces five output files: program.out, program.log, program.err, program.com, and mdanalysis.log.
  • Previously the mdanalysis outputs were displayed to the CMD which meant there was a bloated CMD, in this version all of the mdanalysis outputs are diverted to a seperate log file which includes both INFO and DEBUG modes for further analysis if needed.
  • Default log level is set to INFO verbose mode will enable DEBUG logging, providing more detailed logs to the user.

File Locations:

  • There are now dedicated folders for each run of CodeEntropy, each time CodeEntropy is run it will create a new folder jobxxx, this will read in what is on the disk and increment job numbers.
  • The aim of this is to make sure that each run has its own dedicated place and allow users to have easy access to their results in a clear and consise structure where they are able to keep track of certain runs and jobs.

Data Logging Enhancements:

  • Added a new data_logger.py file which handles the data within CodeEntropy, especially with the output being displayed to the user.
  • On the CMD tables are utilised to show results.
  • Introduced standardization of JSON output for better integration with other systems and tools.

Configuration and Argument Management:

  • Created a new arg_config_manager.py file to handle and manage all command-line arguments within CodeEntropy more efficiently.

File Structure and Organization Improvements:

  • Reorganized the CodeEntropy project structure:
  • CodeEntropy calculations are now within their own folder.
  • Configuration files are placed in a dedicated directory, improving the modularity and maintainability of the codebase.

Updated Command-Line Output:

  • Improved the format of the command-line output to provide clearer results.
  • Integrated the tabulate library to structure the output in a more readable table format.

Test Cases Update:

  • Fixed existing test cases to accommodate changes made with the introduction of the logging system.

Dependency Management:

  • Added the python-json-logger and tabulate package to pyproject.toml as a new dependency for better table formatting in the output.

Impact

  • Enhanced logging system for easier debugging and monitoring, with more detailed logs available in separate files.
  • More structured and consistent output, particularly in JSON and tabulated format.
  • Clearer command-line interface for users, with simplified and improved output.
  • Easier configuration and argument management, making the project more maintainable.
  • Tests and dependencies have been updated to reflect the changes made.

- Creation of a new logging_config.py file which handles the logging cases
 - This produces 5 files: program.out, program.log, program.err, program.com and mdanalysis.log
 - Info is set as default, which is what is shown to the user on CMD if verbose is set the Debug logging will be enabled
- Creation of a new data_logger.py file which records and populates JSON output and table structure
- Creation of a new arg_config_manager.py file which handles all of the arguments within CodeEntropy
- New file structure, CodeEntropy calculations within its own folder and config files witin their own folder
- JSON output file is now standard
- Updated CMD output, cleaner approach as well as using tabulate to structure the results
@harryswift01 harryswift01 added this to the WP4 - Input/Output milestone Mar 24, 2025
@harryswift01 harryswift01 requested a review from jimboid March 24, 2025 16:24
@harryswift01 harryswift01 self-assigned this Mar 24, 2025
This was linked to issues Mar 24, 2025
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.

An excellent PR. Bringing tiered logging to the application and improving how things look. Separating out MDA is a nice touch with its own debug and info levels. The structural improvements to how jobs are run is also a nice to have addition, this means people can easily tweak params without worrying about moving files around in the terminal. This allows users to run things like diff, in future we might provide a wrapper command to do such diffs in an intelligent way. I like that there is now a bit more structure to configs and calcs in the source. Tests look to have been updated to account for these changes.

A very nice PR, safe to merge.

@harryswift01 harryswift01 merged commit 0b96f22 into main Mar 25, 2025
5 checks passed
@harryswift01 harryswift01 deleted the 34-implement-python-logging branch March 25, 2025 12:31
@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

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Implement Python Logging System Support JSON & txt Output Formats

3 participants