Deduplicate proxy startup logging via `logger.StartupInfo` by Copilot · Pull Request #8426 · github/gh-aw-mcpg · GitHub
Skip to content

Deduplicate proxy startup logging via logger.StartupInfo#8426

Merged
lpcox merged 4 commits into
mainfrom
copilot/duplicate-code-fix
Jul 1, 2026
Merged

Deduplicate proxy startup logging via logger.StartupInfo#8426
lpcox merged 4 commits into
mainfrom
copilot/duplicate-code-fix

Conversation

Copilot AI commented Jul 1, 2026

Copy link
Copy Markdown
Contributor

internal/cmd/proxy.go was still hand-rolling startup/shutdown dual logging instead of using the shared helper used elsewhere in cmd. That left the proxy path inconsistent and caused the OpenTelemetry-disabled branch to skip the file-backed startup log sink.

  • What changed

    • Replaced the duplicated log.Printf + logger.LogInfo pairs in runProxy() with logger.StartupInfo(...)
    • Applied the same helper to the proxy shutdown banner for a single logging path
    • Routed the OpenTelemetry disabled message through the shared helper so it is emitted to both stderr and startup logs
  • Result

    • Proxy startup/shutdown logging now follows the same pattern as root.go
    • Startup log formatting is centralized in one helper instead of being repeated at each call site
    • The tracing-disabled path now logs consistently with the tracing-enabled path
  • Representative change

    if tracingCfg != nil {
    	logger.StartupInfo(
    		"OpenTelemetry tracing enabled for proxy: endpoint=%s, service=%s",
    		proxyOTLPEndpoint, proxyOTLPService,
    	)
    } else {
    	logger.StartupInfo("OpenTelemetry tracing disabled for proxy (no --otlp-endpoint configured)")
    }

GitHub Advanced Security started work on behalf of lpcox July 1, 2026 14:47 View session
GitHub Advanced Security finished work on behalf of lpcox July 1, 2026 14:47
GitHub Advanced Security started work on behalf of lpcox July 1, 2026 14:51 View session
GitHub Advanced Security finished work on behalf of lpcox July 1, 2026 14:52
Copilot AI changed the title [WIP] Fix duplicate logging in runProxy function Deduplicate proxy startup logging via logger.StartupInfo Jul 1, 2026
Copilot finished work on behalf of lpcox July 1, 2026 14:57
Copilot AI requested a review from lpcox July 1, 2026 14:57
GitHub Advanced Security started work on behalf of lpcox July 1, 2026 15:00 View session
GitHub Advanced Security finished work on behalf of lpcox July 1, 2026 15:00
@lpcox lpcox marked this pull request as ready for review July 1, 2026 15:28
Copilot AI review requested due to automatic review settings July 1, 2026 15:28

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR standardizes awmg proxy startup/shutdown logging by replacing ad-hoc dual logging (log.Printf + logger.LogInfo) with the shared logger.StartupInfo(...) helper, aligning the proxy command with the rest of internal/cmd.

Changes:

  • Replaced proxy OpenTelemetry enable/disable banner logging with logger.StartupInfo(...) so it logs to both stderr and the startup log sinks.
  • Replaced the “listening” startup log with logger.StartupInfo(...) for consistent dual-output startup logging.
  • Updated the proxy shutdown banner to use the shared logging path (but see review comment about shutdown category).
Show a summary per file
File Description
internal/cmd/proxy.go Switches proxy startup/shutdown banner logs to the shared logger.StartupInfo(...) helper to deduplicate dual logging and align with cmd conventions.

Review details

Tip

Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

  • Files reviewed: 1/1 changed files
  • Comments generated: 1
  • Review effort level: Low

Comment thread internal/cmd/proxy.go
Comment on lines 274 to 276
func() {
log.Println("Shutting down proxy...")
logger.LogInfo("shutdown", "Proxy shutting down")
logger.StartupInfo("Shutting down proxy...")
},
@lpcox

lpcox commented Jul 1, 2026

Copy link
Copy Markdown
Collaborator

@copilot address review feedback

Copilot AI commented Jul 1, 2026

Copy link
Copy Markdown
Contributor Author

GitHub Advanced Security started work on behalf of lpcox July 1, 2026 15:53 View session
Copilot finished work on behalf of lpcox July 1, 2026 15:53
GitHub Advanced Security finished work on behalf of lpcox July 1, 2026 15:53
@lpcox lpcox merged commit 6e003c6 into main Jul 1, 2026
24 checks passed
@lpcox lpcox deleted the copilot/duplicate-code-fix branch July 1, 2026 16:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[duplicate-code] Duplicate Code Pattern: Dual logging bypassing logger.StartupInfo in proxy.go

3 participants