Skip to content

[log] Add debug logging to 5 key Go files#2124

Merged
pelikhan merged 2 commits intomainfrom
add-debug-logging-to-5-files-044d07c55c2435eb
Oct 22, 2025
Merged

[log] Add debug logging to 5 key Go files#2124
pelikhan merged 2 commits intomainfrom
add-debug-logging-to-5-files-044d07c55c2435eb

Conversation

@github-actions
Copy link
Contributor

Summary

Added meaningful debug logging statements to 5 strategic files to help with troubleshooting and development:

  • pkg/cli/run_command.go - Workflow run operations logging
  • pkg/parser/schema.go - Schema validation logging
  • pkg/workflow/expressions.go - Expression parsing logging
  • pkg/cli/audit.go - Audit operations logging
  • pkg/workflow/permissions.go - Permissions handling logging

Details

Files Enhanced

  1. pkg/cli/run_command.go (runLog)

    • Logs workflow validation (local vs remote)
    • Logs workflow trigger success
    • Logs workflow run URLs and database IDs
  2. pkg/parser/schema.go (schemaLog)

    • Logs validation of main workflow frontmatter
    • Logs validation of included file frontmatter
    • Logs engine-specific rule validation
  3. pkg/workflow/expressions.go (expressionsLog)

    • Logs expression parsing attempts
    • Logs tokenization failures
    • Logs successful parsing with token count
    • Logs when breaking long expressions
  4. pkg/cli/audit.go (auditLog)

    • Logs audit start with run metadata
    • Logs output directory configuration
    • Logs artifact download operations
  5. pkg/workflow/permissions.go (permissionsLog)

    • Logs permissions parser creation
    • Logs YAML parsing with content length
    • Logs contents read access determinations

Guidelines Followed

✅ Maximum 5 files per PR (exactly 5 files modified)
✅ No test files modified
✅ Logger naming convention: pkg:filename pattern
✅ Logger arguments have no side effects
✅ Meaningful, helpful messages for debugging
✅ No duplication with user-facing messages

Test Plan

  • ✅ Compiled successfully with make build
  • ✅ Tested debug output with DEBUG=* ./gh-aw compile dev
  • ✅ Verified logging appears correctly in debug output
  • ✅ All loggers use correct naming conventions

Example Debug Output

cli:compile_command Starting workflow compilation: files=1, validate=true, watch=false, noEmit=false
parser:schema Validating engine-specific rules for string engine: copilot
workflow:expressions Parsing expression: github.repository
workflow:expressions Successfully parsed expression with 2 tokens
workflow:permissions Creating new permissions parser
workflow:permissions Parsing permissions YAML: length=45

🤖 Generated with Claude Code

AI generated by Go Logger Enhancement

Added meaningful debug logging statements to help with troubleshooting and development in the following files:

1. pkg/cli/run_command.go - Added runLog for workflow run operations
   - Logs workflow validation (local/remote)
   - Logs workflow trigger success
   - Logs workflow run URLs and IDs

2. pkg/parser/schema.go - Added schemaLog for schema validation
   - Logs validation of main workflow frontmatter
   - Logs validation of included file frontmatter
   - Logs engine-specific rule validation

3. pkg/workflow/expressions.go - Added expressionsLog for expression parsing
   - Logs expression parsing start/success/failure
   - Logs token count after successful parsing
   - Logs when breaking long expressions

4. pkg/cli/audit.go - Added auditLog for audit operations
   - Logs audit start with run details
   - Logs output directory usage
   - Logs artifact download operations

5. pkg/workflow/permissions.go - Added permissionsLog for permissions handling
   - Logs permissions parser creation
   - Logs permissions YAML parsing
   - Logs contents read access checks

All logging follows the project's conventions:
- Uses logger.New("pkg:filename") pattern
- Log arguments have no side effects
- Meaningful messages for debugging
- No duplication with user-facing messages

Changes validated with:
- make build (successful compilation)
- DEBUG=* ./gh-aw compile dev (verified debug output)

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

Co-Authored-By: Claude <noreply@anthropic.com>
@github-actions github-actions bot added automation enhancement New feature or request labels Oct 22, 2025
Copy link
Contributor

Copilot AI commented Oct 22, 2025

@pelikhan I've opened a new pull request, #2126, to work on those changes. Once the pull request is ready, I'll request review from you.

Copy link
Contributor

@pelikhan pelikhan left a comment

Choose a reason for hiding this comment

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

@copilot review verbose logging and migrate to use logger inthode

Copy link
Contributor

Copilot AI commented Oct 22, 2025

@pelikhan I've opened a new pull request, #2130, to work on those changes. Once the pull request is ready, I'll request review from you.

@pelikhan pelikhan merged commit af0a37d into main Oct 22, 2025
15 checks passed
@pelikhan pelikhan deleted the add-debug-logging-to-5-files-044d07c55c2435eb branch October 22, 2025 13:06
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.

2 participants