Skip to content

Commit 0234dfa

Browse files
committed
scripts/debug: Add debugging helper tool.
1 parent 7e7fd57 commit 0234dfa

File tree

1 file changed

+7
-12
lines changed

1 file changed

+7
-12
lines changed

Diff for: zulipterminal/scripts/debug_helper.py

+7-12
Original file line numberDiff line numberDiff line change
@@ -10,16 +10,17 @@
1010

1111
import argparse
1212
import json
13+
import logging
1314
import os
1415
import re
1516
import subprocess
16-
import logging # Added logging
1717
from typing import Optional
1818

1919
# Configure logging
2020
logging.basicConfig(level=logging.INFO)
2121
logger = logging.getLogger(__name__)
2222

23+
2324
def analyze_debug_log(log_file: str = "debug.log") -> None:
2425
"""
2526
Analyze a debug log file for common issues.
@@ -67,9 +68,7 @@ def test_connectivity(server_url: Optional[str] = None) -> None:
6768
break
6869

6970
if not server_url:
70-
logger.error(
71-
"No server URL provided and couldn't find one in ~/.zuliprc"
72-
)
71+
logger.error("No server URL provided and couldn't find one in ~/.zuliprc")
7372
return
7473

7574
logger.info(f"Testing connectivity to {server_url}...")
@@ -81,9 +80,7 @@ def test_connectivity(server_url: Optional[str] = None) -> None:
8180
logger.info(f"Successfully connected to {server_url}")
8281
try:
8382
settings = response.json()
84-
logger.info(
85-
f"Server version: {settings.get('zulip_version', 'unknown')}"
86-
)
83+
logger.info(f"Server version: {settings.get('zulip_version', 'unknown')}")
8784
except json.JSONDecodeError:
8885
logger.error("Received response, but couldn't parse as JSON")
8986
else:
@@ -106,7 +103,7 @@ def check_terminal_capabilities() -> None:
106103
logger.info(f"COLORTERM: {os.environ['COLORTERM']}")
107104

108105
# Check for Unicode support
109-
logger.info("\nTesting Unicode rendering capabilities:")
106+
logger.info("Testing Unicode rendering capabilities:")
110107
test_chars = [
111108
("Basic symbols", "▶ ◀ ✓ ✗"),
112109
("Emoji (simple)", "😀 🙂 👍"),
@@ -121,7 +118,7 @@ def check_terminal_capabilities() -> None:
121118
try:
122119
import urwid # noqa: F401
123120

124-
logger.info("\nUrwid detected. Running basic urwid test...")
121+
logger.info("Urwid detected. Running basic urwid test...")
125122
# This doesn't actually run a visual test - just checks if urwid can be imported
126123
logger.info("Urwid import successful")
127124
except ImportError:
@@ -141,9 +138,7 @@ def main() -> None:
141138

142139
# Connectivity test
143140
conn_parser = subparsers.add_parser("connect", help="Test connectivity")
144-
conn_parser.add_argument(
145-
"--server", help="Server URL (e.g., https://chat.zulip.org)"
146-
)
141+
conn_parser.add_argument("--server", help="Server URL (e.g., https://chat.zulip.org)")
147142

148143
# Terminal test
149144
subparsers.add_parser("terminal", help="Check terminal capabilities")

0 commit comments

Comments
 (0)