Commit 0f6216e
authored
[log] Add debug logging to response_writer.go (#636)
## Changes
Enhanced the `internal/server/response_writer.go` file with debug
logging to improve troubleshooting capabilities for HTTP response
handling.
### What was added:
1. **Logger declaration**: Added `logResponseWriter` with namespace
`server:response_writer` following project conventions
2. **Response writer creation**: Logs when a new response writer is
created
3. **Status code tracking**: Logs when HTTP status codes are set
4. **Body writes**: Logs the size of response body writes
5. **Data retrieval**: Logs when body content or status codes are
retrieved
### Benefits:
- Better visibility into HTTP response flow
- Helps debug response-related issues
- Follows the project's logger naming convention (`pkg:filename`)
- No side effects in logger arguments
- Minimal performance impact (logging only when DEBUG is enabled)
### Testing:
The changes follow Go best practices and the project's logging
guidelines from AGENTS.md. To see the debug output:
``````bash
DEBUG=server:response_writer ./awmg --config config.toml
``````
Or enable all server logs:
``````bash
DEBUG=server:* ./awmg --config config.toml
``````
### Quality checklist:
- ✅ Single file modified (focused PR)
- ✅ No test files modified
- ✅ Logger follows `pkg:filename` naming convention
- ✅ Logger arguments have no side effects
- ✅ Meaningful and helpful logging messages
- ✅ No duplicate logging
- ✅ Imports properly formatted
> AI generated by [Go Logger
Enhancement](https://github.com/github/gh-aw-mcpg/actions/runs/21678050763)
<!-- gh-aw-workflow-id: go-logger -->1 file changed
Lines changed: 11 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
3 | 3 | | |
4 | 4 | | |
5 | 5 | | |
| 6 | + | |
| 7 | + | |
6 | 8 | | |
7 | 9 | | |
| 10 | + | |
| 11 | + | |
8 | 12 | | |
9 | 13 | | |
10 | 14 | | |
| |||
15 | 19 | | |
16 | 20 | | |
17 | 21 | | |
| 22 | + | |
18 | 23 | | |
19 | 24 | | |
20 | 25 | | |
21 | 26 | | |
22 | 27 | | |
23 | 28 | | |
24 | 29 | | |
| 30 | + | |
25 | 31 | | |
26 | 32 | | |
27 | 33 | | |
28 | 34 | | |
29 | 35 | | |
| 36 | + | |
30 | 37 | | |
31 | 38 | | |
32 | 39 | | |
33 | 40 | | |
34 | 41 | | |
35 | 42 | | |
36 | | - | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
37 | 46 | | |
38 | 47 | | |
39 | 48 | | |
40 | 49 | | |
| 50 | + | |
41 | 51 | | |
42 | 52 | | |
0 commit comments