Commit c670a2c
authored
Deduplicate startup logging in cmd/root.go via logger helpers (#3515)
~10 consecutive `log.Printf` + `logger.LogInfoMd`/`LogWarn` pairs in
`internal/cmd/root.go` log identical startup messages to both stderr and
structured loggers. Every message change must be applied in two places.
### Changes
- **`internal/logger/startup.go`** — Add `StartupInfo` and `StartupWarn`
that combine both calls:
```go
logger.StartupInfo("Starting MCPG in ROUTED mode on %s", listenAddr)
// replaces:
// log.Printf("Starting MCPG in ROUTED mode on %s", listenAddr)
// logger.LogInfoMd("startup", "Starting in ROUTED mode on %s", listenAddr)
```
- **`internal/cmd/root.go`** — Replace 11 duplicate pairs with
single-line helper calls
- **`internal/logger/startup_test.go`** — Tests verifying both helpers
write to file and markdown loggers
> [!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-build175238182/b510/launcher.test
/tmp/go-build175238182/b510/launcher.test
-test.testlogfile=/tmp/go-build175238182/b510/testlog.txt
-test.paniconexit0 -test.timeout=10m0s -test.v=true
ache/go/1.25.8/x-errorsas cgo_.o 64/bin/as -p vendor/golang.or-atomic
-lang=go1.25 238182/b171/_x00-buildtags -p ity/connectivity-errorsas
-trimpath x_amd64/compile -I /tmp/go-build175docker-cli-plugin-metadata
-I x_amd64/compile` (dns block)
> - Triggering command: `/tmp/go-build3857722332/b514/launcher.test
/tmp/go-build3857722332/b514/launcher.test
-test.testlogfile=/tmp/go-build3857722332/b514/testlog.txt
-test.paniconexit0 -test.timeout=10m0s rtcf��
pkg/mod/google.golang.org/grpc@v1.80.0/binarylog-s tmain.go x_amd64/vet
/x64=/_/GOROOT --local u/13/cc1 x_amd64/vet -o /tmp/go-build175-errorsas
ettings.Ports}} x_amd64/vet -p go.opentelemetry--version -lang=go1.25
x_amd64/vet` (dns block)
> - Triggering command: `/tmp/go-build516878933/b510/launcher.test
/tmp/go-build516878933/b510/launcher.test
-test.testlogfile=/tmp/go-build516878933/b510/testlog.txt
-test.paniconexit0 -test.timeout=10m0s -test.v=true
7722332/b559/tty.test -tests 7722332/b559/importcfg.link
8NDC/SRjZ7_MrzxIbash pkg/mod/go.opent/usr/bin/runc
ache/go/1.25.8/x--root 97a/log.json U02
io.containerd.ru/run/containerd/io.containerd.runtime.v2.task/moby/83fdf3a250dfab704055af7b451aa/usr/bin/runc.original
{{json .NetworkS--log-format che/go-build/ba/json
by/197def118f828/opt/hostedtoolcache/go/1.25.8/x64/pkg/tool/linux_amd64/vet
-importcfg x_amd64/vet runc` (dns block)
> - `invalid-host-that-does-not-exist-12345.com`
> - Triggering command: `/tmp/go-build175238182/b492/config.test
/tmp/go-build175238182/b492/config.test
-test.testlogfile=/tmp/go-build175238182/b492/testlog.txt
-test.paniconexit0 -test.timeout=10m0s -test.v=true ternal/fsapi/fil-p
ternal/fsapi/polgoogle.golang.org/grpc/internal/stats x_amd64/asm
cgo=false false -g" "-lpthread" x_amd64/asm 2381��
238182/b172/_pkg-p
ache/go/1.25.8/xgoogle.golang.org/grpc/health/grpc_health_v1` (dns
block)
> - Triggering command: `/tmp/go-build3857722332/b496/config.test
/tmp/go-build3857722332/b496/config.test
-test.testlogfile=/tmp/go-build3857722332/b496/testlog.txt
-test.paniconexit0 -test.timeout=10m0s -qui�� 4W2NdfqUv
/tmp/go-build175238182/b318/ ache/go/1.25.8/x64/pkg/tool/linu-importcfg
. -imultiarch x86_64-linux-gnu rtcfg -I o
aw-mcpg/internal/config/rules/rules_test.go x_amd64/compile --gdwarf-5
--64 -o x_amd64/compile` (dns block)
> - Triggering command: `/tmp/go-build516878933/b492/config.test
/tmp/go-build516878933/b492/config.test
-test.testlogfile=/tmp/go-build516878933/b492/testlog.txt
-test.paniconexit0 -test.timeout=10m0s -test.v=true
/tmp/go-build3857722332/b001/_pk/run/containerd/io.containerd.runtime.v2.task/moby/1aae6b0541c71bash
576e049387694a82674f762305209147fde512f1ff55f4537e6 e-handler
576e049387694a82/usr/bin/chronyc` (dns block)
> - `nonexistent.local`
> - Triggering command: `/tmp/go-build175238182/b510/launcher.test
/tmp/go-build175238182/b510/launcher.test
-test.testlogfile=/tmp/go-build175238182/b510/testlog.txt
-test.paniconexit0 -test.timeout=10m0s -test.v=true
ache/go/1.25.8/x-errorsas cgo_.o 64/bin/as -p vendor/golang.or-atomic
-lang=go1.25 238182/b171/_x00-buildtags -p ity/connectivity-errorsas
-trimpath x_amd64/compile -I /tmp/go-build175docker-cli-plugin-metadata
-I x_amd64/compile` (dns block)
> - Triggering command: `/tmp/go-build3857722332/b514/launcher.test
/tmp/go-build3857722332/b514/launcher.test
-test.testlogfile=/tmp/go-build3857722332/b514/testlog.txt
-test.paniconexit0 -test.timeout=10m0s rtcf��
pkg/mod/google.golang.org/grpc@v1.80.0/binarylog-s tmain.go x_amd64/vet
/x64=/_/GOROOT --local u/13/cc1 x_amd64/vet -o /tmp/go-build175-errorsas
ettings.Ports}} x_amd64/vet -p go.opentelemetry--version -lang=go1.25
x_amd64/vet` (dns block)
> - Triggering command: `/tmp/go-build516878933/b510/launcher.test
/tmp/go-build516878933/b510/launcher.test
-test.testlogfile=/tmp/go-build516878933/b510/testlog.txt
-test.paniconexit0 -test.timeout=10m0s -test.v=true
7722332/b559/tty.test -tests 7722332/b559/importcfg.link
8NDC/SRjZ7_MrzxIbash pkg/mod/go.opent/usr/bin/runc
ache/go/1.25.8/x--root 97a/log.json U02
io.containerd.ru/run/containerd/io.containerd.runtime.v2.task/moby/83fdf3a250dfab704055af7b451aa/usr/bin/runc.original
{{json .NetworkS--log-format che/go-build/ba/json
by/197def118f828/opt/hostedtoolcache/go/1.25.8/x64/pkg/tool/linux_amd64/vet
-importcfg x_amd64/vet runc` (dns block)
> - `slow.example.com`
> - Triggering command: `/tmp/go-build175238182/b510/launcher.test
/tmp/go-build175238182/b510/launcher.test
-test.testlogfile=/tmp/go-build175238182/b510/testlog.txt
-test.paniconexit0 -test.timeout=10m0s -test.v=true
ache/go/1.25.8/x-errorsas cgo_.o 64/bin/as -p vendor/golang.or-atomic
-lang=go1.25 238182/b171/_x00-buildtags -p ity/connectivity-errorsas
-trimpath x_amd64/compile -I /tmp/go-build175docker-cli-plugin-metadata
-I x_amd64/compile` (dns block)
> - Triggering command: `/tmp/go-build3857722332/b514/launcher.test
/tmp/go-build3857722332/b514/launcher.test
-test.testlogfile=/tmp/go-build3857722332/b514/testlog.txt
-test.paniconexit0 -test.timeout=10m0s rtcf��
pkg/mod/google.golang.org/grpc@v1.80.0/binarylog-s tmain.go x_amd64/vet
/x64=/_/GOROOT --local u/13/cc1 x_amd64/vet -o /tmp/go-build175-errorsas
ettings.Ports}} x_amd64/vet -p go.opentelemetry--version -lang=go1.25
x_amd64/vet` (dns block)
> - Triggering command: `/tmp/go-build516878933/b510/launcher.test
/tmp/go-build516878933/b510/launcher.test
-test.testlogfile=/tmp/go-build516878933/b510/testlog.txt
-test.paniconexit0 -test.timeout=10m0s -test.v=true
7722332/b559/tty.test -tests 7722332/b559/importcfg.link
8NDC/SRjZ7_MrzxIbash pkg/mod/go.opent/usr/bin/runc
ache/go/1.25.8/x--root 97a/log.json U02
io.containerd.ru/run/containerd/io.containerd.runtime.v2.task/moby/83fdf3a250dfab704055af7b451aa/usr/bin/runc.original
{{json .NetworkS--log-format che/go-build/ba/json
by/197def118f828/opt/hostedtoolcache/go/1.25.8/x64/pkg/tool/linux_amd64/vet
-importcfg x_amd64/vet runc` (dns block)
> - `this-host-does-not-exist-12345.com`
> - Triggering command: `/tmp/go-build175238182/b519/mcp.test
/tmp/go-build175238182/b519/mcp.test
-test.testlogfile=/tmp/go-build175238182/b519/testlog.txt
-test.paniconexit0 -test.timeout=10m0s -test.v=true
s/known/fieldmaskpb/field_mask.pb.go @v1.43.0/semconv/v1.37.0/doc.go
x_amd64/compile --gdwarf-5 --64 -o x_amd64/compile 2381�� _.a
238182/b165/ x_amd64/vet --gdwarf-5 /v1.40.0 -o x_amd64/vet` (dns block)
> - Triggering command: `/tmp/go-build3857722332/b523/mcp.test
/tmp/go-build3857722332/b523/mcp.test
-test.testlogfile=/tmp/go-build3857722332/b523/testlog.txt
-test.paniconexit0 -test.timeout=10m0s -o
/tmp/go-build175238182/b459/_pkg_.a -trimpath x_amd64/vet -p
github.com/githu-qE -lang=go1.25 x_amd64/vet -ato�� g_.a -buildtags
x_amd64/vet -errorsas ernal/logger -nilfunc x_amd64/vet` (dns block)
> - Triggering command: `/tmp/go-build516878933/b519/mcp.test
/tmp/go-build516878933/b519/mcp.test
-test.testlogfile=/tmp/go-build516878933/b519/testlog.txt
-test.paniconexit0 -test.timeout=10m0s -test.v=true (create|run)
runtime-runc/mobjson` (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>3 files changed
+127
-28
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
153 | 153 | | |
154 | 154 | | |
155 | 155 | | |
156 | | - | |
157 | | - | |
| 156 | + | |
158 | 157 | | |
159 | 158 | | |
160 | 159 | | |
| |||
210 | 209 | | |
211 | 210 | | |
212 | 211 | | |
213 | | - | |
214 | | - | |
| 212 | + | |
215 | 213 | | |
216 | 214 | | |
217 | 215 | | |
218 | | - | |
219 | | - | |
| 216 | + | |
220 | 217 | | |
221 | 218 | | |
222 | 219 | | |
| |||
225 | 222 | | |
226 | 223 | | |
227 | 224 | | |
228 | | - | |
229 | | - | |
| 225 | + | |
230 | 226 | | |
231 | | - | |
232 | | - | |
| 227 | + | |
233 | 228 | | |
234 | 229 | | |
235 | | - | |
236 | | - | |
| 230 | + | |
237 | 231 | | |
238 | 232 | | |
239 | 233 | | |
| |||
285 | 279 | | |
286 | 280 | | |
287 | 281 | | |
288 | | - | |
289 | | - | |
| 282 | + | |
290 | 283 | | |
291 | 284 | | |
292 | 285 | | |
| |||
318 | 311 | | |
319 | 312 | | |
320 | 313 | | |
321 | | - | |
322 | | - | |
| 314 | + | |
323 | 315 | | |
324 | 316 | | |
325 | 317 | | |
| |||
346 | 338 | | |
347 | 339 | | |
348 | 340 | | |
349 | | - | |
| 341 | + | |
350 | 342 | | |
351 | | - | |
352 | | - | |
353 | 343 | | |
354 | | - | |
| 344 | + | |
355 | 345 | | |
356 | 346 | | |
357 | 347 | | |
| |||
373 | 363 | | |
374 | 364 | | |
375 | 365 | | |
376 | | - | |
377 | | - | |
378 | | - | |
379 | | - | |
| 366 | + | |
| 367 | + | |
380 | 368 | | |
381 | 369 | | |
382 | 370 | | |
383 | 371 | | |
384 | 372 | | |
385 | 373 | | |
386 | | - | |
387 | | - | |
388 | | - | |
389 | | - | |
| 374 | + | |
| 375 | + | |
390 | 376 | | |
391 | 377 | | |
392 | 378 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
0 commit comments