Skip to content

make logger more clear with highlight component and use package name for default component#2154

Merged
yinwm merged 1 commit intosipeed:mainfrom
cytown:logger
Mar 29, 2026
Merged

make logger more clear with highlight component and use package name for default component#2154
yinwm merged 1 commit intosipeed:mainfrom
cytown:logger

Conversation

@cytown
Copy link
Copy Markdown
Contributor

@cytown cytown commented Mar 29, 2026

make logger more clear with highlight component and use package name for default component.

detail see screenshot

📝 Description

🗣️ Type of Change

  • 🐞 Bug fix (non-breaking change which fixes an issue)
  • ✨ New feature (non-breaking change which adds functionality)
  • 📖 Documentation update
  • ⚡ Code refactoring (no functional changes, no api changes)

🤖 AI Code Generation

  • 🤖 Fully AI-generated (100% AI, 0% Human)
  • 🛠️ Mostly AI-generated (AI draft, Human verified/modified)
  • 👨‍💻 Mostly Human-written (Human lead, AI assisted or none)

🔗 Related Issue

📚 Technical Context (Skip for Docs)

  • Reference URL:
  • Reasoning:

🧪 Test Environment

  • Hardware:
  • OS:
  • Model/Provider:
  • Channels:

📸 Evidence (Optional)

Click to view Logs/Screenshots CleanShot 2026-03-29 at 18 22 34@2x

☑️ Checklist

  • My code/docs follow the style of this project.
  • I have performed a self-review of my own changes.
  • I have updated the documentation accordingly.

@sipeed-bot sipeed-bot bot added type: enhancement New feature or request go Pull requests that update go code labels Mar 29, 2026
Copy link
Copy Markdown
Collaborator

@yinwm yinwm left a comment

Choose a reason for hiding this comment

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

LGTM, nice improvement to log readability! The yellow component highlight and auto package name fallback make logs much easier to scan.

A few non-blocking suggestions for future consideration:

  1. The hardcoded ANSI code in FormatPrepare (\x1b[33m) doesn't check if stdout is a TTY. When output is piped or redirected, the escape codes will appear as garbage. Consider checking term.IsTerminal(int(os.Stdout.Fd())) or the ConsoleWriter's NoColor field.

  2. getPackageNameFromFile returns "." when called from a file in the project root (e.g., main.go). A special case for "." returning something like "main" would be cleaner.

  3. Consider adding unit tests for getPackageNameFromFile to cover normal paths and edge cases.

None of these block merging — the change is clean and well-scoped. 🚀

@yinwm yinwm merged commit e34c4f8 into sipeed:main Mar 29, 2026
4 checks passed
@cytown cytown deleted the logger branch March 29, 2026 13:23
andressg79 pushed a commit to andressg79/picoclaw that referenced this pull request Mar 30, 2026
make logger more clear with highlight component and use package name for default component
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

go Pull requests that update go code type: enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants