Skip to content

[log] Add debug logging to campaign and parser modules#7466

Merged
pelikhan merged 1 commit intomainfrom
main-d9bf96febf5e5a8a
Dec 24, 2025
Merged

[log] Add debug logging to campaign and parser modules#7466
pelikhan merged 1 commit intomainfrom
main-d9bf96febf5e5a8a

Conversation

@github-actions
Copy link
Contributor

Summary

Enhanced 5 Go files with debug logging following project guidelines:

  • pkg/campaign/status.go - Added campaign:status logger with logging for:

    • Campaign compiled state computation with workflow count
    • Workflow markdown and lock file validation
    • Lock file staleness detection
    • GitHub issue/PR counts fetching
    • Metrics and cursor tracking from repo memory
  • pkg/parser/github.go - Added parser:github logger with logging for:

    • GitHub token retrieval flow
    • Environment variable detection (GITHUB_TOKEN, GH_TOKEN)
    • gh auth token command fallback
  • pkg/parser/import_directive.go - Added parser:import_directive logger with logging for:

    • Import directive parsing with legacy syntax detection
    • Parsed directive details (path, optional flag, syntax type)
  • pkg/parser/import_error.go - Added parser:import_error logger with logging for:

    • Import error formatting with path and location details
  • pkg/parser/yaml_error.go - Added parser:yaml_error logger with logging for:

    • YAML error extraction with frontmatter offset
    • Error location extraction from goccy format
    • Fallback string parsing for error location

Changes Made

  1. Added logger declarations following the pkg:filename naming convention
  2. Replaced shared package-level logger usage with dedicated file-specific loggers
  3. Added entry point logging for key functions
  4. Added logging for important control flow decisions and state changes
  5. Ensured all log arguments have no side effects

Quality Checklist

  • Maximum 5 files modified
  • No test files modified
  • Each file has logger declaration with correct naming 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
  • Changes validated with make build (no compilation errors)
  • Workflow compilation tested with ./gh-aw compile dev

Testing

Validated changes with:

make build      # ✓ Successful compilation
./gh-aw compile dev  # ✓ Successfully compiled workflow

Notes

These logging enhancements improve debugging capabilities for:

  • Campaign workflow tracking and metrics
  • GitHub authentication token resolution
  • Import directive processing
  • Error formatting and reporting
  • YAML parsing error extraction

Debug logs can be enabled by setting DEBUG=* environment variable.

AI generated by Go Logger Enhancement

Enhanced 5 Go files with debug logging following project guidelines:

- pkg/campaign/status.go: Added campaign:status logger for campaign
  workflow tracking, metrics, and cursor management
- pkg/parser/github.go: Added parser:github logger for token retrieval
- pkg/parser/import_directive.go: Added parser:import_directive logger
  for import parsing
- pkg/parser/import_error.go: Added parser:import_error logger for
  error formatting
- pkg/parser/yaml_error.go: Added parser:yaml_error logger for YAML
  error extraction

All loggers follow the pkg:filename naming convention and include
meaningful logging at function entry points and key decision points.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
@github-actions github-actions bot added automation enhancement New feature or request labels Dec 24, 2025
@pelikhan pelikhan merged commit ce4219c into main Dec 24, 2025
4 checks passed
@pelikhan pelikhan deleted the main-d9bf96febf5e5a8a branch December 24, 2025 06:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

automation enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant