[log] Add debug logging to config validation schema #440
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.
Summary
This PR enhances the
internal/config/validation_schema.gofile with debug logging to help troubleshoot schema validation issues.Changes
logSchemalogger with namespaceconfig:validation_schemafollowing thepkg:filenamenaming conventionfetchAndFixSchemafunction: Added 4 logging calls to track schema fetching from remote URL, HTTP errors, and successvalidateJSONSchemafunction: Added 3 logging calls to track validation start, failures, and successvalidateStringPatternsfunction: Added 2 logging calls to track server count and individual server validationLogging Calls Added (7 total)
fetchAndFixSchema
logSchema.Printf("Fetching schema from URL: %s", url)logSchema.Printf("Schema fetch failed: %v", err)logSchema.Printf("Schema fetch returned non-OK status: %d", resp.StatusCode)logSchema.Print("Schema fetched successfully, applying fixes")validateJSONSchema
logSchema.Printf("Starting JSON schema validation: data_size=%d bytes", len(data))logSchema.Printf("Schema validation failed: %v", err)logSchema.Print("Schema validation completed successfully")validateStringPatterns
logSchema.Printf("Validating string patterns: server_count=%d", len(stdinCfg.MCPServers))logSchema.Printf("Validating server: name=%s, type=%s", name, server.Type)Rationale
The
validation_schema.gofile (371 lines) handles JSON schema validation - a complex operation that can fail in multiple ways. These debug logs will help developers:Quality Checklist
pkg:filenameconventionTesting
Enable debug logging with:
Or enable all debug logs:
DEBUG=* ./awmg --config config.toml