Commit d4608a1
authored
Remove duplicate log calls where global structured logger already covers the event (#2522)
Every significant event in 23+ files was being logged twice: once via a
package-level `logXxx.Printf()` debug logger (stderr, `DEBUG=`
controlled) and once via the global `logger.LogInfo/Warn/Error()`
structured logger (always written to files). This created ~40 duplicate
log call-pairs with no policy to guide which to use.
## Changes
Removed 24 redundant local `logXxx.Printf()` calls across 6 files,
keeping only the global structured call where both logged the same
event:
- **`internal/server/auth.go`** — Remove 3 `logAuth.Printf` calls for
auth failed/success events already covered by
`logger.LogErrorMd`/`LogInfo`
- **`internal/launcher/launcher.go`** — Remove 9 `logLauncher.Printf`
calls for `GetOrLaunch`/`GetOrLaunchForSession` events already covered
by adjacent
`logger.LogDebugWithServer`/`LogInfoWithServer`/`LogErrorWithServer`
- **`internal/mcp/schema.go`** — Remove 4 `logSchema.Printf` calls for
schema normalization outcomes already covered by `logger.LogWarn`
- **`internal/mcp/connection.go`** — Remove 4 `logConn.Printf` calls for
connection lifecycle events already covered by
`logger.LogInfo`/`LogInfoWithServer`
- **`internal/server/handlers.go`** — Remove 2
`logHandlers.Print/Printf` calls for `/close` endpoint events already
covered by `logger.LogInfo`/`LogWarn`
- **`internal/server/routed.go`** — Remove local `log :=
logger.New(logNamespace)` and `log.Printf` inside `rejectIfShutdown`
closure; `logger.LogWarn` already covers the shutdown rejection
**Before:**
```go
logAuth.Printf("Authentication failed: invalid API key")
logger.LogErrorMd("auth", "Authentication failed: invalid API key, remote=%s, path=%s", r.RemoteAddr, r.URL.Path)
```
**After:**
```go
logger.LogErrorMd("auth", "Authentication failed: invalid API key, remote=%s, path=%s", r.RemoteAddr, r.URL.Path)
```
All debug-only `logXxx.Printf` calls with no global logger counterpart
are preserved — they continue to serve development tracing via
`DEBUG=namespace:*`.
> [!WARNING]
>
> <details>
> <summary>Firewall rules blocked me from connecting to one or more
addresses (expand for details)</summary>
>
> #### I tried to connect to the following addresses, but was blocked by
firewall rules:
>
> - `example.com`
> - Triggering command: `/tmp/go-build1349128381/b329/launcher.test
/tmp/go-build1349128381/b329/launcher.test
-test.testlogfile=/tmp/go-build1349128381/b329/testlog.txt
-test.paniconexit0 -test.timeout=10m0s -test.v=true _.a 166736/b151/`
(dns block)
> - Triggering command: `/tmp/go-build3953803593/b333/launcher.test
/tmp/go-build3953803593/b333/launcher.test
-test.testlogfile=/tmp/go-build3953803593/b333/testlog.txt
-test.paniconexit0 -test.timeout=10m0s --no�� g_.a
64/pkg/tool/linu-trimpath ache/go/1.25.8/x64/pkg/tool/linux_amd64/vet go
ternal/fips140/d-unsafeptr=false x_amd64/cgo
ache/go/1.25.8/x64/pkg/tool/linux_amd64/vet --no�� KRDG6iSQG x_amd64/cgo
ache/go/1.25.8/x64/pkg/tool/linux_amd64/vet --local
k/gh-aw-mcpg/gh--V=full 86_64/as
ache/go/1.25.8/x64/pkg/tool/linu-buildtags` (dns block)
> - `invalid-host-that-does-not-exist-12345.com`
> - Triggering command: `/tmp/go-build1349128381/b314/config.test
/tmp/go-build1349128381/b314/config.test
-test.testlogfile=/tmp/go-build1349128381/b314/testlog.txt
-test.paniconexit0 -test.timeout=10m0s -test.v=true mt-go@v0.1.7/for-n1
mt-go@v0.1.7/par--format=format:%H %ct %D
64/pkg/tool/linu--end-of-options -p github.com/model-o -lang=go1.25
64/pkg/tool/linu-trimpath ter-�� _.a 166736/b151/
de/node/bin/bash-lang=go1.25 -o /dev/null /tmp/cctRuc9T.s
/usr/libexec/gcc/tmp/go-build1349128381/b175/vet.cfg` (dns block)
> - Triggering command: `/tmp/go-build3953803593/b318/config.test
/tmp/go-build3953803593/b318/config.test
-test.testlogfile=/tmp/go-build3953803593/b318/testlog.txt
-test.paniconexit0 -test.timeout=10m0s push��
aw-mcpg/internal/launcher/connection_pool.go .cfg util.test go --local
64/pkg/tool/linu/tmp/go-build1106856649/b085/vet.cfg util.test 3491��
5762130/b248/_pkg_.a --scope docker-compose
--property=Memor/opt/hostedtoolcache/go/1.25.8/x64/pkg/tool/linux_amd64/vet
b/gh-aw-mcpg/int/tmp/go-build1106856649/b235/vet.cfg
--property=MemoryHigh=170M docker-compose` (dns block)
> - `nonexistent.local`
> - Triggering command: `/tmp/go-build1349128381/b329/launcher.test
/tmp/go-build1349128381/b329/launcher.test
-test.testlogfile=/tmp/go-build1349128381/b329/testlog.txt
-test.paniconexit0 -test.timeout=10m0s -test.v=true _.a 166736/b151/`
(dns block)
> - Triggering command: `/tmp/go-build3953803593/b333/launcher.test
/tmp/go-build3953803593/b333/launcher.test
-test.testlogfile=/tmp/go-build3953803593/b333/testlog.txt
-test.paniconexit0 -test.timeout=10m0s --no�� g_.a
64/pkg/tool/linu-trimpath ache/go/1.25.8/x64/pkg/tool/linux_amd64/vet go
ternal/fips140/d-unsafeptr=false x_amd64/cgo
ache/go/1.25.8/x64/pkg/tool/linux_amd64/vet --no�� KRDG6iSQG x_amd64/cgo
ache/go/1.25.8/x64/pkg/tool/linux_amd64/vet --local
k/gh-aw-mcpg/gh--V=full 86_64/as
ache/go/1.25.8/x64/pkg/tool/linu-buildtags` (dns block)
> - `slow.example.com`
> - Triggering command: `/tmp/go-build1349128381/b329/launcher.test
/tmp/go-build1349128381/b329/launcher.test
-test.testlogfile=/tmp/go-build1349128381/b329/testlog.txt
-test.paniconexit0 -test.timeout=10m0s -test.v=true _.a 166736/b151/`
(dns block)
> - Triggering command: `/tmp/go-build3953803593/b333/launcher.test
/tmp/go-build3953803593/b333/launcher.test
-test.testlogfile=/tmp/go-build3953803593/b333/testlog.txt
-test.paniconexit0 -test.timeout=10m0s --no�� g_.a
64/pkg/tool/linu-trimpath ache/go/1.25.8/x64/pkg/tool/linux_amd64/vet go
ternal/fips140/d-unsafeptr=false x_amd64/cgo
ache/go/1.25.8/x64/pkg/tool/linux_amd64/vet --no�� KRDG6iSQG x_amd64/cgo
ache/go/1.25.8/x64/pkg/tool/linux_amd64/vet --local
k/gh-aw-mcpg/gh--V=full 86_64/as
ache/go/1.25.8/x64/pkg/tool/linu-buildtags` (dns block)
> - `this-host-does-not-exist-12345.com`
> - Triggering command: `/tmp/go-build1349128381/b338/mcp.test
/tmp/go-build1349128381/b338/mcp.test
-test.testlogfile=/tmp/go-build1349128381/b338/testlog.txt
-test.paniconexit0 -test.timeout=10m0s -test.v=true assword=$GITHUB_-s
assword=$GITHUB_-w ache/go/1.25.8/x-buildmode=exe --gdwarf-5 --64 -o
ache/go/1.25.8/x-extld=gcc -E 166736/b193/_pkg_.a -m64 x_amd64/vet
/tmp/go-build417bash g/x/net/http/htt/usr/bin/runc
-fno-stack-prote--version x_amd64/vet` (dns block)
> - Triggering command: `/tmp/go-build3953803593/b342/mcp.test
/tmp/go-build3953803593/b342/mcp.test
-test.testlogfile=/tmp/go-build3953803593/b342/testlog.txt
-test.paniconexit0 -test.timeout=10m0s --no�� --noprofile u/13/cc1 .cfg
--local 64/src/runtime/c-V=full cal/bin/bash
ache/go/1.25.8/x64/pkg/tool/linux_amd64/vet` (dns block)
>
> If you need me to access, download, or install something from one of
these locations, you can either:
>
> - Configure [Actions setup
steps](https://gh.io/copilot/actions-setup-steps) to set up my
environment, which run before the firewall is enabled
> - Add the appropriate URLs or hosts to the custom allowlist in this
repository's [Copilot coding agent
settings](https://github.com/github/gh-aw-mcpg/settings/copilot/coding_agent)
(admins only)
>
> </details>
<!-- START COPILOT CODING AGENT TIPS -->
---
💬 Send tasks to Copilot coding agent from
[Slack](https://gh.io/cca-slack-docs) and
[Teams](https://gh.io/cca-teams-docs) to turn conversations into code.
Copilot posts an update in your thread when it's finished.6 files changed
Lines changed: 0 additions & 24 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
64 | 64 | | |
65 | 65 | | |
66 | 66 | | |
67 | | - | |
68 | 67 | | |
69 | 68 | | |
70 | 69 | | |
71 | 70 | | |
72 | 71 | | |
73 | 72 | | |
74 | | - | |
75 | 73 | | |
76 | 74 | | |
77 | 75 | | |
| |||
85 | 83 | | |
86 | 84 | | |
87 | 85 | | |
88 | | - | |
89 | 86 | | |
90 | 87 | | |
91 | 88 | | |
92 | 89 | | |
93 | 90 | | |
94 | 91 | | |
95 | 92 | | |
96 | | - | |
97 | 93 | | |
98 | 94 | | |
99 | 95 | | |
| |||
103 | 99 | | |
104 | 100 | | |
105 | 101 | | |
106 | | - | |
107 | 102 | | |
108 | 103 | | |
109 | 104 | | |
| |||
116 | 111 | | |
117 | 112 | | |
118 | 113 | | |
119 | | - | |
120 | 114 | | |
121 | 115 | | |
122 | 116 | | |
| |||
135 | 129 | | |
136 | 130 | | |
137 | 131 | | |
138 | | - | |
139 | 132 | | |
140 | 133 | | |
141 | 134 | | |
| |||
157 | 150 | | |
158 | 151 | | |
159 | 152 | | |
160 | | - | |
161 | 153 | | |
162 | 154 | | |
163 | 155 | | |
| |||
171 | 163 | | |
172 | 164 | | |
173 | 165 | | |
174 | | - | |
175 | 166 | | |
176 | 167 | | |
177 | 168 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
76 | 76 | | |
77 | 77 | | |
78 | 78 | | |
79 | | - | |
80 | 79 | | |
81 | 80 | | |
82 | 81 | | |
| |||
117 | 116 | | |
118 | 117 | | |
119 | 118 | | |
120 | | - | |
121 | 119 | | |
122 | 120 | | |
123 | 121 | | |
| |||
171 | 169 | | |
172 | 170 | | |
173 | 171 | | |
174 | | - | |
175 | 172 | | |
176 | 173 | | |
177 | 174 | | |
| |||
200 | 197 | | |
201 | 198 | | |
202 | 199 | | |
203 | | - | |
204 | 200 | | |
205 | 201 | | |
206 | 202 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
17 | 17 | | |
18 | 18 | | |
19 | 19 | | |
20 | | - | |
21 | 20 | | |
22 | 21 | | |
23 | 22 | | |
| |||
43 | 42 | | |
44 | 43 | | |
45 | 44 | | |
46 | | - | |
47 | 45 | | |
48 | 46 | | |
49 | 47 | | |
50 | | - | |
51 | 48 | | |
52 | 49 | | |
53 | 50 | | |
| |||
80 | 77 | | |
81 | 78 | | |
82 | 79 | | |
83 | | - | |
84 | 80 | | |
85 | 81 | | |
86 | 82 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
45 | 45 | | |
46 | 46 | | |
47 | 47 | | |
48 | | - | |
49 | 48 | | |
50 | 49 | | |
51 | 50 | | |
| |||
55 | 54 | | |
56 | 55 | | |
57 | 56 | | |
58 | | - | |
59 | 57 | | |
60 | 58 | | |
61 | 59 | | |
62 | 60 | | |
63 | 61 | | |
64 | 62 | | |
65 | | - | |
66 | 63 | | |
67 | 64 | | |
68 | 65 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
35 | 35 | | |
36 | 36 | | |
37 | 37 | | |
38 | | - | |
39 | 38 | | |
40 | 39 | | |
41 | 40 | | |
| |||
48 | 47 | | |
49 | 48 | | |
50 | 49 | | |
51 | | - | |
52 | 50 | | |
53 | 51 | | |
54 | 52 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
20 | 20 | | |
21 | 21 | | |
22 | 22 | | |
23 | | - | |
24 | 23 | | |
25 | 24 | | |
26 | | - | |
27 | 25 | | |
28 | 26 | | |
29 | 27 | | |
| |||
0 commit comments