Skip to content

Conversation

Copy link
Contributor

Copilot AI commented Dec 7, 2025

Implements a Python logging system to replace scattered print() statements, enabling debug-level verbosity control and optional log file generation.

Changes

New logging module (logger.py)

  • Singleton pattern with colored console output (red=ERROR, yellow=WARNING, cyan=INFO, gray=DEBUG)
  • File handler with timestamps, always captures DEBUG regardless of console level
  • Helper functions: debug(), info(), warning(), error(), critical()

Command-line arguments

  • --log-level {DEBUG,INFO,WARNING,ERROR,CRITICAL} (default: INFO)
  • --log-file <path> for persistent logs
  • --no-color to disable ANSI codes

Integration

  • Updated main.py and compile.py to use logger instead of print()
  • Added DEBUG messages for arguments, file lists, and processing details
  • Maintains existing message format ([ANALYZER], [AUTOFIX], [COMPILE])

Testing

  • 8 unit tests covering singleton pattern, log levels, file I/O, and formatting

Usage

# Debug mode with detailed output
./main.py --analyze /path/to/kernel --log-level DEBUG

# Persistent logging
./main.py --fix --json-input json/checkpatch.json --log-file logs/fix.log

# Quiet mode (warnings/errors only)
./main.py --analyze /path/to/kernel --log-level WARNING
# In code
import logger
logger.debug("[MODULE] Detailed troubleshooting info")
logger.info("[MODULE] Normal operation message")
logger.error("[MODULE] Something failed")
Original prompt

This section details on the original issue you should resolve

<issue_title>Debug on/off</issue_title>
<issue_description>Crear una nueva rama. Establecer un nivel de debug por argumentos que active los echos DEBUG (puede que no existan aun) por consola. En el fondo establecer un sistema de logging. Puede ser interesante generar un logfile.</issue_description>

<agent_instructions>Usa Python</agent_instructions>

Comments on the Issue (you are @copilot in this section)


💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.

Copilot AI changed the title [WIP] Add debug on/off functionality with logging Add configurable logging system with DEBUG level and file output Dec 7, 2025
Copilot AI requested a review from Kilynho December 7, 2025 23:36
@Kilynho Kilynho marked this pull request as ready for review December 7, 2025 23:38
@Kilynho Kilynho merged commit 48e8475 into master Dec 7, 2025
@Kilynho Kilynho deleted the copilot/add-debug-logging-system branch December 7, 2025 23:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Debug on/off

2 participants