Skip to content

[log] Add debug logging to CLI utility and configuration files#7594

Merged
pelikhan merged 1 commit intomainfrom
main-f6c5a1cd2917f3f8
Dec 25, 2025
Merged

[log] Add debug logging to CLI utility and configuration files#7594
pelikhan merged 1 commit intomainfrom
main-f6c5a1cd2917f3f8

Conversation

@github-actions
Copy link
Contributor

Summary

This PR enhances 5 Go files with debug logging following the project's logging guidelines from AGENTS.md. Session 28 adds dedicated loggers to support better troubleshooting and development visibility.

Files Enhanced

1. pkg/cli/ci.go (logger: cli:ci)

  • CI environment detection with environment variable name logging
  • No CI environment detected logging

2. pkg/cli/github.go (logger: cli:github)

  • GitHub host resolution from environment variables
  • Default GitHub host fallback logging

3. pkg/cli/compile_config.go (logger: cli:compile_config)

  • Error message sanitization with length logging
  • Secret pattern redaction with pattern details
  • Sanitization application confirmation
  • Validation results sanitization with workflow count

4. pkg/cli/logs_display.go (logger: cli:logs_display)

  • Logs overview display entry with run count and verbose flag
  • No processed runs detection
  • Table rendering with aggregated totals summary

5. pkg/cli/logs_command.go (logger: cli:logs_command)

  • Logs command execution start with argument count
  • Workflow name resolution from command argument
  • Start date resolution with before/after values
  • End date resolution with before/after values
  • Engine parameter validation logging
  • Logs download execution with final parameters

Key Features

  • Zero side effects: All logger arguments are direct values or simple string formatting
  • Meaningful context: Logs provide parameter counts, configuration values, and state transitions
  • Consistent naming: Follows pkg:filename convention (e.g., cli:ci, cli:github)
  • Performance-conscious: Uses simple Printf statements without expensive computations

Testing

  • Built successfully with make build
  • Validated with DEBUG=* ./gh-aw compile dev
  • Confirmed CI detection logging works in GitHub Actions environment

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 are properly formatted
  • Changes validated with make build
  • Workflow compilation tested with DEBUG=* ./gh-aw compile dev

Cache Status

  • Current commit: 7a3e1e790a75052edbe1e5455ec855588ee20948
  • Session number: 28
  • Total files enhanced across all sessions: 34
  • Cache updated: /tmp/gh-aw/cache-memory/go-logger/

AI generated by Go Logger Enhancement

Enhanced 5 Go files with debug logging following project guidelines:

- pkg/cli/ci.go: CI environment detection logging
- pkg/cli/github.go: GitHub host resolution logging
- pkg/cli/compile_config.go: Validation error sanitization logging
- pkg/cli/logs_display.go: Logs display metrics aggregation logging
- pkg/cli/logs_command.go: Logs command parameter validation logging

All loggers follow the pkg:filename naming convention and avoid side effects
in log arguments. Session 28 of the go-logger enhancement initiative.

🤖 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 25, 2025
@pelikhan pelikhan merged commit de8b23c into main Dec 25, 2025
4 checks passed
@pelikhan pelikhan deleted the main-f6c5a1cd2917f3f8 branch December 25, 2025 10: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