Repository navigation
Release v1.1.0
Added
Enhanced Logging and Debugging System
- Hierarchical Log Levels: Five-level logging system (TRACE, DEBUG, INFO, WARN, ERROR) for granular control over debug output
- Log Categories: Nine specialized categories for filtering by subsystem:
PEER- Peer connection lifecycle and managementUPLOAD- Upload manager decisions, choking rounds, and piece servingDOWNLOAD- Download progress, piece reception, and completionDHT- Distributed Hash Table operations and peer discoveryTRACKER- Tracker communication, announces, and peer listsPIECE- Piece verification, hash checks, and assemblyQUEUE- Request queue operations and managementPROTOCOL- BitTorrent protocol message parsing and handlingSYSTEM- System-level events, initialization, and shutdown
- Advanced CLI Flags: New command-line options for debugging:
--debug- Enable INFO level logging (suppress TUI)--verbose/-v- Enable DEBUG level logging with detailed operations--trace- Enable TRACE level logging for ultra-verbose output--log-category=<categories>- Filter logs by one or more categories (comma-separated)--log-level=<level>- Set minimum log level (TRACE, DEBUG, INFO, WARN, ERROR)
- Rate Limiting: Throttle mechanism to prevent log spam from repetitive messages
- Aggregate Statistics: Periodic metric summaries logged every 30 seconds
- Structured Logging: Consistent log format with timestamps, levels, categories, and structured data objects
- Category Filtering: Ability to focus on specific subsystems for targeted debugging
- Comprehensive Documentation:
- Added
docs/LOGGING.mdwith complete logging guide - Updated
CONTRIBUTING.mdwith logging best practices for contributors - Updated
README.mdwith quick debugging examples
- Added
Changed
- Console Output: Replaced all raw
console.logcalls with categorized Logger calls across the codebase - Debug Mode Behavior:
--verboseand--traceflags now automatically suppress TUI (no need for--debug) - Upload Logging: Converted noisy choke/unchoke messages to aggregate summaries
- Tracker Logging: Replaced emoji-heavy console logs with structured Logger output
- Download Logging: Migrated download progress messages to use LogCategory.DOWNLOAD
Fixed
- Log Filtering: Category filtering now works correctly - only shows logs from specified categories
- TUI Suppression: Fixed issue where
--verboseand--tracewould show TUI instead of logs - Log Consistency: Eliminated mixed usage of
console.logand Logger throughout the codebase
Developer Experience
- Logger API: Simple, consistent API for all logging needs
Logger.trace(category, message, data?)- Ultra-verbose operation loggingLogger.debug(category, message, data?)- Detailed debugging informationLogger.info(category, message, data?)- Important milestones and eventsLogger.warn(category, message, data?)- Recoverable issues and warningsLogger.error(category, message, data?)- Critical errors and failuresLogger.throttle(key, interval, callback)- Rate-limited loggingLogger.aggregate(key, value)- Metric aggregation with periodic flushing
Full Changelog: v1.0.0...v1.1.0