Skip to content

Standardize loggings in the tools#205

Open
GREENRAT-K405 wants to merge 3 commits intoControlCore-Project:devfrom
GREENRAT-K405:fix/add-loggings-tools
Open

Standardize loggings in the tools#205
GREENRAT-K405 wants to merge 3 commits intoControlCore-Project:devfrom
GREENRAT-K405:fix/add-loggings-tools

Conversation

@GREENRAT-K405
Copy link

@GREENRAT-K405 GREENRAT-K405 commented Feb 4, 2026

This standardizes the output mechanism by replacing ad-hoc print statements with python's built-in logging module.
I have also, changes the centralized logging configuration in concore.py to ensure consistent formatting (timestamps and the log level.

Benefits:

  • All logs now include timestamps, making it easier to debug timing issues and race conditions in the simulation.
  • Log verbosity can be easily adjusted globally (e.g., switch to INFO during production) without modifying individual scripts.
  • The console output is no longer flooded with internal debug messages

here is the run of demo/sample3:
image

this closes #192

Copilot AI review requested due to automatic review settings February 4, 2026 19:25
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR standardizes logging across the codebase by replacing ad-hoc print statements with Python's built-in logging module and centralizing the logging configuration in concore.py.

Changes:

  • Centralized logging configuration in concore.py with DEBUG level, timestamps, and logger names
  • Converted print statements to appropriate logging calls (info, debug, error) across 11 tool files
  • Added library-specific logging level suppression for matplotlib, PIL, urllib3, and requests

Reviewed changes

Copilot reviewed 13 out of 13 changed files in this pull request and generated 5 comments.

Show a summary per file
File Description
concore.py Centralized logging configuration with DEBUG level, timestamps, and muted noisy library loggers
tools/shannon.py Converted print statements to logging.info and logging.debug
tools/pwrap.py Converted print statements to logging calls at appropriate levels (info/debug/error)
tools/plotymlag.py Converted print statements to logging.info and logging.debug
tools/plotym.py Converted print statements to logging.info and logging.debug
tools/plotu.py Converted print statements to logging.info
tools/pidsig.py Converted print statements to logging.info and logging.error
tools/pidmayuresh.py Converted print statements to logging calls at appropriate levels
tools/pid2.py Converted print statements to logging.info and logging.debug
tools/learn.py Converted print statement to logging.info
tools/cwrap.py Converted print statements to logging calls at appropriate levels (info/debug/error)
tools/cardiac_pm.py Added startup message and converted print to logging.debug
tools/bangbang.py Added startup message and converted print to logging.debug

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

print(yuyu)
print(name1+'='+init_simtime_u)
print(name2+'='+init_simtime_ym)
logging.info(f"API Key: {apikey}")
Copy link

Copilot AI Feb 4, 2026

Choose a reason for hiding this comment

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

Security concern: logging API keys at INFO level could expose sensitive credentials in production logs. Consider either removing this log statement, masking the API key (e.g., showing only the first/last few characters), or changing to DEBUG level so it can be easily disabled in production environments.

Copilot uses AI. Check for mistakes.
print(yuyu)
print(name1+'='+init_simtime_u)
print(name2+'='+init_simtime_ym)
logging.info(f"API Key: {apikey}")
Copy link

Copilot AI Feb 4, 2026

Choose a reason for hiding this comment

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

Security concern: logging API keys at INFO level could expose sensitive credentials in production logs. Consider either removing this log statement, masking the API key (e.g., showing only the first/last few characters), or changing to DEBUG level so it can be easily disabled in production environments.

Copilot uses AI. Check for mistakes.
GREENRAT-K405 and others added 2 commits February 5, 2026 00:58
@GREENRAT-K405
Copy link
Author

@pradeeban, please review the changes.

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