Skip to content

Commit 1bf9412

Browse files
jzhuclaude
andcommitted
feat: Implement global debug flag (--debug/-d) for CLI
This commit connects the previously defined but unused DEBUG_OPTION to actual debug logging functionality. When the --debug or -d flag is passed, the CLI now enables DEBUG level logging for all modules, providing detailed diagnostic information. Changes: - Added DEBUG_OPTION to imports in cli/app.py - Created global_options callback to configure logging when debug flag is set - Debug logging includes timestamps and module names for easy tracing - Flag works with all commands (e.g., cam --debug config validate) Usage: cam --debug <command> # Enable debug logging cam -d <command> # Short form Example output shows: - ConfigManager initialization details - Config location discovery and loading - Validation process details - Timestamps and module source of each debug message 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
1 parent 7983551 commit 1bf9412

1 file changed

Lines changed: 14 additions & 0 deletions

File tree

  • code_assistant_manager/cli

code_assistant_manager/cli/app.py

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020
from .options import (
2121
CONFIG_FILE_OPTION,
2222
CONFIG_OPTION,
23+
DEBUG_OPTION,
2324
TOOL_ARGS_OPTION,
2425
VALIDATE_VERBOSE_OPTION,
2526
)
@@ -33,6 +34,19 @@
3334
add_completion=False,
3435
)
3536

37+
38+
@app.callback(invoke_without_command=False)
39+
def global_options(debug: bool = DEBUG_OPTION):
40+
"""Global options for the CLI application."""
41+
if debug:
42+
# Configure debug logging for all modules
43+
logging.basicConfig(
44+
level=logging.DEBUG,
45+
format="%(asctime)s - %(name)s - %(levelname)s - %(message)s",
46+
)
47+
logger.debug("Debug logging enabled")
48+
49+
3650
# Import commands to register them with the app
3751
from . import commands # noqa: F401,E402
3852

0 commit comments

Comments
 (0)