feat: replace print() calls with Python logging module#4
Open
Aditya8840 wants to merge 1 commit intomainfrom
Open
feat: replace print() calls with Python logging module#4Aditya8840 wants to merge 1 commit intomainfrom
Aditya8840 wants to merge 1 commit intomainfrom
Conversation
Replace all 11 print() calls across agent.py and main.py with proper
logging using logging.getLogger("droidpilot"). Each message is mapped
to the correct severity (INFO, WARNING, ERROR, DEBUG).
Add _setup_logging() helper in main.py that configures the droidpilot
logger with a clean format — no timestamps for TTY, timestamps when
piped to a file or in verbose mode.
Add --verbose (-v) and --quiet (-q) mutually exclusive CLI flags to
control output verbosity (DEBUG and WARNING levels respectively).
Closes #2
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Closes #2
print()calls acrossagent.pyandmain.pywith properly-leveledlogging.getLogger("droidpilot")calls (INFO, WARNING, ERROR, DEBUG)_setup_logging()helper inmain.pywith clean format (no timestamps for TTY, timestamps for file/verbose output)--verbose(-v) and--quiet(-q) mutually exclusive CLI flags to control output verbosityChanges
droidpilot/main.py_setup_logging(verbose, quiet)helper configuring thedroidpilotlogger-v/--verboseflag (DEBUG level + timestamps) and-q/--quietflag (WARNING level only)print(..., file=sys.stderr)error output withlogger.error()print()status messages withlogger.info()main()droidpilot/agent.pyloggingimport and module-levellogger = logging.getLogger("droidpilot")print()calls with appropriate severity levels:logger.info()for device info, task, step progress, and completionlogger.warning()for UI read failures and missing actionslogger.debug()for action result detailsTest plan
droidpilot "test"— should show INFO-level output without timestampsdroidpilot -v "test"— should show DEBUG-level output with timestampsdroidpilot -q "test"— should only show warnings and errorsdroidpilot "test" 2>debug.log— log file should contain timestamps-vand-qare mutually exclusive (parser rejects both)🤖 Generated with Claude Code