Commit 8d1a49e
authored
[log] Add debug logging to dockerutil/env.go (#1522)
## Changes
Adds a debug logger to `internal/dockerutil/env.go` to trace Docker `-e`
flag environment variable expansion.
### What was added
- **Logger declaration**: `var logDockerutil =
logger.New("dockerutil:env")` following the project's `pkg:filename`
naming convention
- **4 debug logging calls** in `ExpandEnvArgs`:
1. Function entry log with input arg count
2. Per-env-var log when a variable is successfully found and expanded
3. Per-env-var log when a referenced variable is **not found** in the
process environment (key debugging signal)
4. Completion log with output arg count
### Why this is useful
`ExpandEnvArgs` is called when building Docker command arguments,
converting passthrough `-e VAR_NAME` flags to `-e VAR_NAME=value`.
Without logging, there's no visibility into:
- Which env vars are being passed through to Docker containers
- Which env vars are missing from the gateway process environment (a
common misconfiguration)
- Whether the expansion produced the expected number of args
The "not found" log is especially valuable - it highlights env vars that
are referenced in config but not set in the environment, which is a
common source of unexpected Docker container behavior.
### Debug usage
```bash
# Enable dockerutil debug logging
DEBUG=dockerutil:* ./awmg --config config.toml
# Example output
[dockerutil:env] Expanding env args: input_count=8
[dockerutil:env] Expanding env var: name=GITHUB_PERSONAL_ACCESS_TOKEN
[dockerutil:env] Env var not found in process environment: name=MISSING_VAR
[dockerutil:env] Env args expansion complete: output_count=9
```
### Quality checklist
- [x] Exactly 1 file modified
- [x] No test files modified
- [x] Logger declaration added following `pkg:filename` convention
(`dockerutil:env`)
- [x] Logger arguments don't compute anything or cause side effects
(only passes existing variable names/counts)
- [x] Logging messages are meaningful and helpful
- [x] No duplicate logging with existing logs
- [x] Import statements properly formatted with stdlib imports before
external imports
> Generated by [Go Logger
Enhancement](https://github.com/github/gh-aw-mcpg/actions/runs/22523661602)
<!-- gh-aw-agentic-workflow: Go Logger Enhancement, engine: copilot, id:
22523661602, workflow_id: go-logger, run:
https://github.com/github/gh-aw-mcpg/actions/runs/22523661602 -->
<!-- gh-aw-workflow-id: go-logger -->1 file changed
+8
-0
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
4 | 4 | | |
5 | 5 | | |
6 | 6 | | |
| 7 | + | |
| 8 | + | |
7 | 9 | | |
8 | 10 | | |
| 11 | + | |
| 12 | + | |
9 | 13 | | |
10 | 14 | | |
11 | 15 | | |
| 16 | + | |
12 | 17 | | |
13 | 18 | | |
14 | 19 | | |
| |||
20 | 25 | | |
21 | 26 | | |
22 | 27 | | |
| 28 | + | |
23 | 29 | | |
24 | 30 | | |
25 | 31 | | |
26 | 32 | | |
27 | 33 | | |
| 34 | + | |
28 | 35 | | |
29 | 36 | | |
30 | 37 | | |
31 | 38 | | |
| 39 | + | |
32 | 40 | | |
33 | 41 | | |
0 commit comments