Skip to content

[log] Add debug logging to main.go#914

Merged
lpcox merged 1 commit intomainfrom
go-logger-main-enhancement-cac39c40171042f8
Feb 13, 2026
Merged

[log] Add debug logging to main.go#914
lpcox merged 1 commit intomainfrom
go-logger-main-enhancement-cac39c40171042f8

Conversation

@github-actions
Copy link
Contributor

Summary

Enhanced main.go with debug logging to improve troubleshooting and development visibility.

Changes Made

Added 7 meaningful debug logging statements:

  • Application lifecycle: Log at application start and before executing root command
  • Version string construction: Log when building version string with metadata
  • Version determination: Log whether using ldflags version or defaulting to 'dev'
  • Git commit tracking: Log commit source (ldflags vs build info) and extraction process
  • Build metadata: Log commit hash found in build info

Technical Details

  • Added logger import: "github.com/github/gh-aw-mcpg/internal/logger"
  • Added logger declaration: var log = logger.New("main:main")
  • All logging follows project guidelines from AGENTS.md:
    • Uses correct naming convention (main:main)
    • No side effects in log arguments
    • Meaningful messages for debugging
    • Focused on entry points and control flow

Testing

To see the new debug logs in action:

DEBUG=main:* ./awmg --version

This will show the version string construction process with all intermediate steps.

Quality Checklist

  • ✅ Exactly 1 file modified (focused, single-file PR)
  • ✅ No test files modified
  • ✅ Logger naming follows pkg:filename convention
  • ✅ Logger arguments don't compute anything or cause side effects
  • ✅ Logging messages are meaningful and helpful
  • ✅ No duplicate logging with existing logs
  • ✅ Import statements properly formatted

AI generated by Go Logger Enhancement

- Added logger import and declaration using 'main:main' namespace
- Added 7 meaningful debug logging statements:
  - Log at application start
  - Log version string construction
  - Log version determination (ldflags vs dev)
  - Log git commit source (ldflags vs build info)
  - Log commit hash extraction from build info
  - Log before executing root command

All logging follows project guidelines with no side effects in arguments.
@github-actions github-actions bot added automation enhancement New feature or request logging labels Feb 12, 2026
@github-actions
Copy link
Contributor Author

Sanitize environment variables in Docker args logging
Add tools.json logging for MCP server tool discovery
GitHub MCP: ✅
Serena activate_project: ✅
Playwright title contains "GitHub": ✅
File write + cat: ✅
Overall: PASS

AI generated by Smoke Codex

@lpcox lpcox marked this pull request as ready for review February 13, 2026 03:42
Copilot AI review requested due to automatic review settings February 13, 2026 03:42
@lpcox lpcox merged commit 3e52289 into main Feb 13, 2026
4 checks passed
@lpcox lpcox deleted the go-logger-main-enhancement-cac39c40171042f8 branch February 13, 2026 03:43
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR enhances the main entry point (main.go) with debug logging statements to improve troubleshooting and development visibility during application startup and version string construction. The changes follow the project's logging guidelines and add meaningful debug information without impacting runtime behavior when debug logging is disabled.

Changes:

  • Added logger import and declaration for debug logging in main.go
  • Added 7 debug log statements tracking application lifecycle, version determination, and build metadata extraction
  • Enhanced visibility into version string construction process for debugging purposes

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

"github.com/github/gh-aw-mcpg/internal/logger"
)

var log = logger.New("main:main")
Copy link

Copilot AI Feb 13, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The logger variable should use a descriptive name following the established codebase convention. The majority of the codebase (20 out of 23 logger declarations) uses descriptive names like logLauncher, logValidation, logMiddleware, etc. The AGENTS.md guidelines (line 312) explicitly state that descriptive names are "preferred" and generic log is only "acceptable for simple cases."

Recommended change: var logMain = logger.New("main:main") to align with the predominant pattern in the codebase and improve clarity, especially since main.go imports the standard library's fmt package which could potentially cause confusion if log were also imported in the future.

Copilot uses AI. Check for mistakes.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants