Skip to content

Make logging optional with --logging flag in installer #3

@Helmi

Description

@Helmi

Description

Make logging functionality optional and disabled by default to prevent log files from growing too large. Logging should only be enabled when explicitly requested via a --logging flag during installation or update.

Context

Project area: Installer, CLI, Core functionality
Complexity: 5/10 (moderate)
Current state: Logging is always enabled and can create large log files over time

Technical Details

Affected files:

  • src/ccnotify/cli.py - Add --logging flag to install/update commands
  • src/ccnotify/installer/flows.py - Pass logging preference to hook configuration
  • src/ccnotify/cli.py::update_claude_settings() - Update hook command with/without --logging
  • src/ccnotify/notify.py - Accept --logging argument and conditionally enable logging
  • README.md - Document the new logging option

Requirements

  1. Installer Changes

    • Add --logging flag to the install and update commands
    • When --logging is used, configure hooks to call the script with --logging
    • When not used, configure hooks without the logging flag
    • Update existing installations to remove logging if not specified
  2. Script Changes

    • Modify notify.py to accept a --logging command-line argument
    • Only enable logging when the flag is present
    • Keep existing logging behavior when flag is used
    • Completely disable logging (no file creation) when flag is absent
  3. Hook Configuration

    • Update update_claude_settings() to conditionally add --logging to the hook command
    • Ensure the hook command is:
      • With logging: uv run /path/to/ccnotify.py --logging
      • Without logging: uv run /path/to/ccnotify.py
  4. Documentation

    • Update README.md to document the --logging flag
    • Explain that logging is off by default
    • Show how to enable logging during installation

Implementation Steps

  • Add --logging flag to CLI install/update commands in cli.py
  • Modify BaseFlow._configure_claude_hooks() to accept logging preference
  • Update update_claude_settings() to conditionally add --logging to hook command
  • Add --logging argument parser to notify.py
  • Modify setup_logging() in notify.py to check for the flag
  • Test installation with and without --logging flag
  • Verify hooks are configured correctly in both cases
  • Update README.md with logging documentation
  • Test that existing installations can be updated to remove logging

Acceptance Criteria

  • uvx ccnotify install installs without logging by default
  • uvx ccnotify install --logging installs with logging enabled
  • Hook commands in Claude settings reflect the logging preference
  • No log files are created when logging is disabled
  • Existing installations can be updated to change logging preference
  • Documentation clearly explains the logging option
  • Script runs correctly with and without the --logging flag

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions