Replace print statements with structured logging#1
Conversation
Co-authored-by: CSSFrancis <41125831+CSSFrancis@users.noreply.github.com>
Co-authored-by: CSSFrancis <41125831+CSSFrancis@users.noreply.github.com>
Co-authored-by: CSSFrancis <41125831+CSSFrancis@users.noreply.github.com>
Co-authored-by: CSSFrancis <41125831+CSSFrancis@users.noreply.github.com>
|
@copilot This looks good. Can you add in the option to change the logging level in the top menubar. Something like view-->set_log_level--> and then have selectable options for the different levels. |
Co-authored-by: CSSFrancis <41125831+CSSFrancis@users.noreply.github.com>
Added in commit ae7de55. The View → Set Log Level submenu now includes selectable options for DEBUG, INFO, WARNING, ERROR, and CRITICAL levels. Features:
The menu structure: Updated documentation in LOGGING.md to include GUI instructions alongside the environment variable method. |
|
@copilot can you rebase this branch and then update based on the changes? |
Rebased onto main branch (563b98f). Changes are in commit 63efd6d. The rebase resolved conflicts with recent main changes and added logging to new files:
All print statements have been replaced with logging, including those added in the 31 commits since the branch was created. Note: The rebased branch requires a force push since the commit history was rewritten. To complete the update, run: git push --force-with-lease origin copilot/remove-print-statements-loggingOr I can create a new PR with the rebased changes if preferred. |
Replaced all print statements throughout the codebase with Python's logging module to enable proper log level control and structured output.
Note: This PR has been rebased onto the latest main branch to incorporate recent changes and resolve conflicts.
Changes
Centralized configuration (
spyde/logging_config.py)LOG_LEVEL(defaults to INFO)set_log_level()functionGUI integration for log level control
Per-module loggers across 20 files (~100+ print statements)
__init__.py,main_window.py,signal_tree.py,qt_scrapper.pydrawing/multiplot.py,drawing/selector.py,drawing/plot_states.py,qt/subwindow.py,actions/base.py,actions/pyxem.pymisc/dialogs/dialogs.py,misc/dialogs/movie_export.pydrawing/toolbars/rounded_toolbar.py,drawing/toolbars/caret_group.py,drawing/toolbars/plot_control_toolbar.pyexternal/pyqtgraph/scale_bar.py,external/pyqtgraph/histogram_widget.pyAppropriate log levels
DEBUGfor diagnostic details (UI interactions, data updates)INFOfor significant events (signal loading, cluster startup)WARNINGfor unexpected conditionsERROR/EXCEPTIONfor failuresDocumentation (
LOGGING.md)Usage
Setting Log Level
Via GUI (Recommended): View → Set Log Level → Select desired level
Via Environment Variable:
export LOG_LEVEL=DEBUGOriginal prompt
💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.