Commit 3e52289
authored
[log] Add debug logging to main.go (#914)
## 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:
``````bash
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](https://github.com/github/gh-aw-mcpg/actions/runs/21946284845)
<!-- gh-aw-workflow-id: go-logger -->1 file changed
+13
-0
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
6 | 6 | | |
7 | 7 | | |
8 | 8 | | |
| 9 | + | |
9 | 10 | | |
10 | 11 | | |
| 12 | + | |
| 13 | + | |
11 | 14 | | |
| 15 | + | |
| 16 | + | |
12 | 17 | | |
13 | 18 | | |
| 19 | + | |
14 | 20 | | |
15 | 21 | | |
16 | 22 | | |
17 | 23 | | |
18 | 24 | | |
| 25 | + | |
19 | 26 | | |
20 | 27 | | |
21 | 28 | | |
| |||
25 | 32 | | |
26 | 33 | | |
27 | 34 | | |
| 35 | + | |
28 | 36 | | |
29 | 37 | | |
30 | 38 | | |
31 | 39 | | |
| 40 | + | |
32 | 41 | | |
33 | 42 | | |
| 43 | + | |
34 | 44 | | |
35 | 45 | | |
36 | 46 | | |
37 | 47 | | |
38 | 48 | | |
| 49 | + | |
39 | 50 | | |
40 | 51 | | |
| 52 | + | |
41 | 53 | | |
42 | 54 | | |
43 | 55 | | |
44 | 56 | | |
45 | 57 | | |
46 | 58 | | |
47 | 59 | | |
| 60 | + | |
48 | 61 | | |
49 | 62 | | |
50 | 63 | | |
| |||
0 commit comments