Merged
Conversation
Add logProxyCmd = logger.New("cmd:proxy") debug logger to the proxy
subcommand and add 6 meaningful debug log calls:
- detectGuardWasm: log the baked-in guard path check, detection result
- runProxy: log proxy startup parameters, resolved GitHub API URL,
and TLS certificate directory when TLS is enabled
This makes the proxy startup flow observable under DEBUG=cmd:* without
duplicating existing logger.LogInfo (file logger) calls.
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Contributor
There was a problem hiding this comment.
Pull request overview
Adds a package-scoped debug logger for the proxy CLI subcommand and emits additional debug-level diagnostics to aid local troubleshooting without impacting normal log output.
Changes:
- Introduces
logProxyCmd = logger.New("cmd:proxy")ininternal/cmd/proxy.go. - Adds debug log lines around baked-in guard detection, proxy startup configuration, GitHub API URL resolution, and TLS certificate generation.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Comment on lines
47
to
+51
| if _, err := os.Stat(containerGuardWasmPath); err == nil { | ||
| logProxyCmd.Printf("Auto-detected baked-in guard: %s", containerGuardWasmPath) | ||
| return containerGuardWasmPath | ||
| } | ||
| logProxyCmd.Print("Baked-in guard not found, --guard-wasm flag required") |
There was a problem hiding this comment.
The message "Baked-in guard not found" is logged for any os.Stat error. If the file exists but Stat fails (e.g., permission/IO error), this is misleading and hides the real cause. Consider branching on os.IsNotExist(err) for the 'not found' message, and otherwise log the error (or include it in the debug output) before returning.
Suggested change
| if _, err := os.Stat(containerGuardWasmPath); err == nil { | |
| logProxyCmd.Printf("Auto-detected baked-in guard: %s", containerGuardWasmPath) | |
| return containerGuardWasmPath | |
| } | |
| logProxyCmd.Print("Baked-in guard not found, --guard-wasm flag required") | |
| _, err := os.Stat(containerGuardWasmPath) | |
| if err == nil { | |
| logProxyCmd.Printf("Auto-detected baked-in guard: %s", containerGuardWasmPath) | |
| return containerGuardWasmPath | |
| } | |
| if os.IsNotExist(err) { | |
| logProxyCmd.Print("Baked-in guard not found, --guard-wasm flag required") | |
| } else { | |
| logProxyCmd.Printf("Error checking for baked-in guard at %s: %v", containerGuardWasmPath, err) | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Adds a
logProxyCmd = logger.New("cmd:proxy")debug logger tointernal/cmd/proxy.goand 6 meaningful debug log calls.Changes
File:
internal/cmd/proxy.govar logProxyCmd = logger.New("cmd:proxy")— follows thepkg:filenameconvention and thelogXxxnaming pattern used across the codebaseloggerwas already importedLogging calls added
detectGuardWasm()"Checking for baked-in guard at %s"detectGuardWasm()"Auto-detected baked-in guard: %s"detectGuardWasm()"Baked-in guard not found, --guard-wasm flag required"runProxy()"Starting proxy: listen=%s, guard=%s, mode=%s, tls=%v"runProxy()"Resolved GitHub API URL: %s, explicit flag=%v"runProxy()"Generating TLS certificates in: %s"Why this file?
cmd/proxy.goimportsloggerand useslogger.LogInfo(file logger) throughout but had no debug logger (logger.New()). The existing file-logger calls go toproxy.logalways; the new debug calls only emit output whenDEBUG=cmd:*orDEBUG=*is set, providing zero-overhead diagnostics for developers.Testing
Enable with: