Conversation
Add logger declarations and meaningful debug logging calls to 5 files that previously had no log instrumentation: - pkg/console/spinner.go: Log TTY detection, accessibility mode, and spinner lifecycle events (start/stop/already-running guard) - pkg/parser/import_processor.go: Log entry/exit of the public ProcessImportsFromFrontmatterWithSource API with file paths and results - pkg/stringutil/identifiers.go: Log MarkdownToLockFile and LockFileToMarkdown path transformations - pkg/stringutil/urls.go: Log ExtractDomainFromURL calls and parse errors - pkg/cli/fix_codemods.go: Log the codemod registry count on load Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
There was a problem hiding this comment.
Pull request overview
Adds debug logging across several packages to improve observability of spinner lifecycle, import processing, and common string/path helpers.
Changes:
- Added namespace loggers and debug statements for spinner creation/start/stop behavior.
- Added debug logs around import processing entrypoint (inputs, errors, result sizes).
- Added debug logs for identifier path conversions and URL domain extraction; logged codemod registry load size.
Reviewed changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| pkg/console/spinner.go | Adds console:spinner debug logs for TTY/accessibility detection and lifecycle events. |
| pkg/parser/import_processor.go | Adds parser:import_processor logs for import processing inputs, errors, and summary counts. |
| pkg/stringutil/identifiers.go | Adds stringutil:identifiers logs for markdown/lockfile path conversions. |
| pkg/stringutil/urls.go | Adds stringutil:urls logs for domain extraction and parse failures. |
| pkg/cli/fix_codemods.go | Adds cli:fix_codemods logger and logs registry size on load. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
You can also share your feedback on Copilot code review. Take the survey.
| urlsLog.Printf("Extracting domain from URL: %s", urlStr) | ||
| // Handle full URLs with protocols (http://, https://) | ||
| if strings.HasPrefix(urlStr, "http://") || strings.HasPrefix(urlStr, "https://") { | ||
| // Parse full URL | ||
| parsedURL, err := url.Parse(urlStr) | ||
| if err != nil { | ||
| // Fall back to string manipulation if parsing fails | ||
| urlsLog.Printf("URL parse failed, using fallback: %v", err) |
There was a problem hiding this comment.
ExtractDomainFromURL logs the full input URL. This helper is used on access log entries and workflow tool URLs (e.g., Squid logs), which may include sensitive data in query strings, fragments, or userinfo. Consider logging only the extracted hostname (or a redacted form that strips query/fragment/userinfo) to avoid leaking secrets when DEBUG is enabled; similarly avoid printing the raw parse error if it may echo the original URL.
| urlsLog.Printf("Extracting domain from URL: %s", urlStr) | |
| // Handle full URLs with protocols (http://, https://) | |
| if strings.HasPrefix(urlStr, "http://") || strings.HasPrefix(urlStr, "https://") { | |
| // Parse full URL | |
| parsedURL, err := url.Parse(urlStr) | |
| if err != nil { | |
| // Fall back to string manipulation if parsing fails | |
| urlsLog.Printf("URL parse failed, using fallback: %v", err) | |
| urlsLog.Printf("Extracting domain from URL") | |
| // Handle full URLs with protocols (http://, https://) | |
| if strings.HasPrefix(urlStr, "http://") || strings.HasPrefix(urlStr, "https://") { | |
| // Parse full URL | |
| parsedURL, err := url.Parse(urlStr) | |
| if err != nil { | |
| // Fall back to string manipulation if parsing fails | |
| urlsLog.Printf("URL parse failed, using fallback") |
Summary
pkg/console/spinner.go: AddedspinnerLoglogger (console:spinner) with logging for TTY detection, accessibility mode detection, and lifecycle events (spinner created, started, already-running guard, stopped)pkg/parser/import_processor.go: Added log calls to the publicProcessImportsFromFrontmatterWithSourceentry point using the pre-declaredimportLog— logs workflow file path, base dir, errors, and result counts (imported files, merged tools size)pkg/stringutil/identifiers.go: AddedidentifiersLoglogger (stringutil:identifiers) with logging forMarkdownToLockFileandLockFileToMarkdownpath conversionspkg/stringutil/urls.go: AddedurlsLoglogger (stringutil:urls) with logging forExtractDomainFromURLcalls and URL parse failurespkg/cli/fix_codemods.go: AddedfixCodemodsLoglogger (cli:fix_codemods) with a log call inGetAllCodemodsreporting the registry size on loadTest plan
make build— no compilation errorsmake fmt— code properly formattedgo build ./pkg/console/... ./pkg/stringutil/... ./pkg/parser/... ./pkg/cli/...— all packages build cleanlyDEBUG=console:spinner(or similar) is set, so no runtime behavior changes