Skip to content

[log] Add debug logging to spinner, import processor, and utility packages#19894

Merged
pelikhan merged 2 commits intomainfrom
log/add-debug-logging-utilities-b0465ac5fc297cbb
Mar 7, 2026
Merged

[log] Add debug logging to spinner, import processor, and utility packages#19894
pelikhan merged 2 commits intomainfrom
log/add-debug-logging-utilities-b0465ac5fc297cbb

Conversation

@github-actions
Copy link
Contributor

@github-actions github-actions bot commented Mar 6, 2026

Summary

  • pkg/console/spinner.go: Added spinnerLog logger (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 public ProcessImportsFromFrontmatterWithSource entry point using the pre-declared importLog — logs workflow file path, base dir, errors, and result counts (imported files, merged tools size)
  • pkg/stringutil/identifiers.go: Added identifiersLog logger (stringutil:identifiers) with logging for MarkdownToLockFile and LockFileToMarkdown path conversions
  • pkg/stringutil/urls.go: Added urlsLog logger (stringutil:urls) with logging for ExtractDomainFromURL calls and URL parse failures
  • pkg/cli/fix_codemods.go: Added fixCodemodsLog logger (cli:fix_codemods) with a log call in GetAllCodemods reporting the registry size on load

Test plan

  • make build — no compilation errors
  • make fmt — code properly formatted
  • go build ./pkg/console/... ./pkg/stringutil/... ./pkg/parser/... ./pkg/cli/... — all packages build cleanly
  • Logging only activates when DEBUG=console:spinner (or similar) is set, so no runtime behavior changes

Generated by Go Logger Enhancement ·

  • expires on Mar 8, 2026, 8:30 PM UTC

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>
@github-actions github-actions bot added automation enhancement New feature or request labels Mar 6, 2026
@pelikhan pelikhan marked this pull request as ready for review March 7, 2026 01:15
Copilot AI review requested due to automatic review settings March 7, 2026 01:15
@pelikhan pelikhan merged commit 230645c into main Mar 7, 2026
49 checks passed
@pelikhan pelikhan deleted the log/add-debug-logging-utilities-b0465ac5fc297cbb branch March 7, 2026 01:15
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Comment on lines +42 to +49
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)
Copy link

Copilot AI Mar 7, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Suggested change
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")

Copilot uses AI. Check for mistakes.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

automation enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants