Skip to content

Commit 3b1a364

Browse files
authored
[log] Add debug logging to resolveWasmCacheDir in cmd/flags_logging (#5494)
Adds 3 debug logging calls to `resolveWasmCacheDir` in `internal/cmd/flags_logging.go` to trace how the WASM compilation cache directory is resolved at startup. ### Changes - Log when directory is resolved from the `--wasm-cache-dir` CLI flag - Log when directory is resolved from the `MCP_GATEWAY_WASM_CACHE_DIR` environment variable - Log when directory falls back to the default (`<log-dir>/wazero-cache`) ### Why This Is Useful When debugging startup issues or verifying configuration, it's helpful to know which source (CLI flag, env var, or default) determined the WASM cache directory. The existing `debugLog` from `root.go` is reused — no new logger declaration was needed. Enable via: ```bash DEBUG=cmd:root ./awmg --config config.toml ``` > Generated by [Go Logger Enhancement](https://github.com/github/gh-aw-mcpg/actions/runs/25703783871/agentic_workflow) · ● 6.2M · [◷](https://github.com/search?q=repo%3Agithub%2Fgh-aw-mcpg+%22gh-aw-workflow-id%3A+go-logger%22&type=pullrequests) <!-- gh-aw-agentic-workflow: Go Logger Enhancement, engine: copilot, version: 1.0.40, model: claude-sonnet-4.6, id: 25703783871, workflow_id: go-logger, run: https://github.com/github/gh-aw-mcpg/actions/runs/25703783871 --> <!-- gh-aw-workflow-id: go-logger -->
2 parents a0d5a99 + d554b36 commit 3b1a364

1 file changed

Lines changed: 5 additions & 1 deletion

File tree

internal/cmd/flags_logging.go

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,16 +29,20 @@ func defaultWasmCacheDir(logDir string) string {
2929

3030
func resolveWasmCacheDir(flagChanged bool, flagValue, effectiveLogDir string) string {
3131
if trimmed := strings.TrimSpace(flagValue); flagChanged && trimmed != "" {
32+
debugLog.Printf("WASM cache dir resolved from CLI flag: %q", trimmed)
3233
return trimmed
3334
}
3435

3536
if envValue, exists := os.LookupEnv(wasmCacheDirEnvVar); exists {
3637
if trimmed := strings.TrimSpace(envValue); trimmed != "" {
38+
debugLog.Printf("WASM cache dir resolved from %s: %q", wasmCacheDirEnvVar, trimmed)
3739
return trimmed
3840
}
3941
}
4042

41-
return defaultWasmCacheDir(effectiveLogDir)
43+
resolved := defaultWasmCacheDir(effectiveLogDir)
44+
debugLog.Printf("WASM cache dir resolved from default (logDir=%q): %q", effectiveLogDir, resolved)
45+
return resolved
4246
}
4347

4448
func init() {

0 commit comments

Comments
 (0)