Skip to content
This repository was archived by the owner on Apr 27, 2026. It is now read-only.
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -35,3 +35,4 @@ scripts/snicker/candidates.txt
.qt_for_python/
cmtdata/
**/build/
test_venv/
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Should be removed imo

6 changes: 5 additions & 1 deletion src/jmbase/support.py
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,8 @@ class JMColorizer(GenericColorizer):
joinmarket_alert = ['']
core_alert = ['']
debug_silence = [False]
# Global variable to track whether colored output is enabled
colored_output = [True]
Copy link

Copilot AI Jul 5, 2025

Choose a reason for hiding this comment

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

[nitpick] Consider using a simple boolean global (e.g., colored_output_enabled: bool) with a global declaration in set_logging_color instead of a single-element list, which can be confusing for future maintainers.

Suggested change
colored_output = [True]
colored_output_enabled = True

Copilot uses AI. Check for mistakes.
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Simple boolean is best suited imo


class JoinMarketStreamHandler(ColorizingStreamHandler):

Expand Down Expand Up @@ -182,7 +184,7 @@ def jmprint(msg, level="info"):

fmtfn = eval(level)
fmtd_msg = fmtfn(msg)
if sys.stdout.isatty():
if sys.stdout.isatty() and colored_output[0]:
print(jm_colorizer.colorize_message(fmtd_msg))
else:
print(fmtd_msg)
Expand All @@ -198,6 +200,8 @@ def set_logging_level(level):
handler.setLevel(level)

def set_logging_color(colored=False):
# Update the global colored_output setting
colored_output[0] = colored
if colored and sys.stdout.isatty():
handler.colorizer = jm_colorizer
else:
Expand Down
Loading