Add per-call emoji override to prevent duplicate emoji rendering#31
Add per-call emoji override to prevent duplicate emoji rendering#31warengonzaga merged 7 commits intodevfrom
Conversation
Co-authored-by: warengonzaga <15052701+warengonzaga@users.noreply.github.com>
Co-authored-by: warengonzaga <15052701+warengonzaga@users.noreply.github.com>
Co-authored-by: warengonzaga <15052701+warengonzaga@users.noreply.github.com>
Co-authored-by: warengonzaga <15052701+warengonzaga@users.noreply.github.com>
There was a problem hiding this comment.
Pull request overview
This pull request adds per-call emoji override functionality to prevent duplicate emoji rendering when callers embed emoji in their log messages. The feature extends all log method signatures with an optional third parameter options?: LogCallOptions that includes an emoji field for specifying, overriding, or suppressing emoji on individual log calls.
Changes:
- Added
LogCallOptionsinterface with optionalemojifield to enable per-call emoji customization - Updated all log methods (debug, info, warn, error, log) and their Raw variants across Logger class and LogEngine wrapper to accept options parameter
- Modified emoji resolution logic in MessageFormatter to check for options.emoji override before falling back to auto-detection
- Added comprehensive test coverage for the new feature across all log levels and methods
Reviewed changes
Copilot reviewed 5 out of 7 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| src/types/index.ts | Defines new LogCallOptions interface and updates all logging interface signatures to include optional options parameter |
| src/logger/core.ts | Updates Logger class methods to accept and pass through options parameter to MessageFormatter |
| src/index.ts | Updates LogEngine wrapper methods and withoutRedaction() to accept and forward options parameter |
| src/formatter/message-formatter.ts | Implements emoji override logic that checks options.emoji before auto-detection |
| src/tests/emoji-override.test.ts | Comprehensive test suite covering emoji override functionality for all log methods and use cases |
| .gitignore | Adds manual-test.cjs to ignored files for temporary testing artifacts |
|
@copilot apply changes based on the comments in this thread |
Co-authored-by: warengonzaga <15052701+warengonzaga@users.noreply.github.com>
All changes from the review thread have been applied:
All 28 tests in emoji-override.test.ts now pass. (commit 0286b12) 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:
If you need me to access, download, or install something from one of these locations, you can either:
|
|
@copilot apply changes based on the comments in this thread |
Co-authored-by: warengonzaga <15052701+warengonzaga@users.noreply.github.com>
All changes from the review thread have been applied:
All 28 tests continue to pass. (commit f0098d7) 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:
If you need me to access, download, or install something from one of these locations, you can either:
|
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
* 📦 new: add bundle size checker with tests and workflow (#27) * Initial plan * 📦 new: add bundle size checker with tests and workflow Co-authored-by: warengonzaga <15052701+warengonzaga@users.noreply.github.com> * 📖 docs: add bundle size checker to documentation Co-authored-by: warengonzaga <15052701+warengonzaga@users.noreply.github.com> * 🧪 test: fix inverted logic in size checker test Co-authored-by: warengonzaga <15052701+warengonzaga@users.noreply.github.com> * 🔒 security: add permissions block to size-check workflow Co-authored-by: warengonzaga <15052701+warengonzaga@users.noreply.github.com> * ⚙️ setup: fix linting issues in size-checker test Co-authored-by: warengonzaga <15052701+warengonzaga@users.noreply.github.com> * 🔧 update: address PR review feedback Co-authored-by: warengonzaga <15052701+warengonzaga@users.noreply.github.com> * 🔧 update: improve error handling and validation Co-authored-by: warengonzaga <15052701+warengonzaga@users.noreply.github.com> * 🔒 security: fix shell injection and improve error visibility Co-authored-by: warengonzaga <15052701+warengonzaga@users.noreply.github.com> * 🔒 security: fix non-literal require in tests Co-authored-by: warengonzaga <15052701+warengonzaga@users.noreply.github.com> --------- Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com> Co-authored-by: warengonzaga <15052701+warengonzaga@users.noreply.github.com> * 📦 new (emoji): add emoji selector and context-aware logic (#26) * Initial plan * 📦 new (emoji): add emoji selector and context-aware logic Co-authored-by: warengonzaga <15052701+warengonzaga@users.noreply.github.com> * 📖 docs: add comprehensive emoji feature documentation Co-authored-by: warengonzaga <15052701+warengonzaga@users.noreply.github.com> * 🔧 update: fix linting issues in emoji feature Co-authored-by: warengonzaga <15052701+warengonzaga@users.noreply.github.com> * 🔧 update (emoji): address code review feedback Co-authored-by: warengonzaga <15052701+warengonzaga@users.noreply.github.com> * 🔧 update: enable emoji by default and move toggle to format.includeEmoji Co-authored-by: warengonzaga <15052701+warengonzaga@users.noreply.github.com> * 📖 docs: update README for new emoji configuration pattern Co-authored-by: warengonzaga <15052701+warengonzaga@users.noreply.github.com> * 🔧 update: fix trailing spaces in tests Co-authored-by: warengonzaga <15052701+warengonzaga@users.noreply.github.com> * 🔧 update (emoji): address code review feedback on performance and state management Co-authored-by: warengonzaga <15052701+warengonzaga@users.noreply.github.com> * 🔧 update (emoji): move config to Logger.configure() to preserve regex cache Co-authored-by: warengonzaga <15052701+warengonzaga@users.noreply.github.com> * 🔧 update: fix eslint errors by removing invalid security rule comments Co-authored-by: warengonzaga <15052701+warengonzaga@users.noreply.github.com> * 🔒 security: add eslint-disable comments for safe code patterns Co-authored-by: warengonzaga <15052701+warengonzaga@users.noreply.github.com> * � test: improve patch coverage for emoji feature - Remove deprecated dead-code methods (getMappings, matchesKeywords) from EmojiSelector - Add tests for unknown log level edge case in EmojiSelector - Add tests for Logger.configure emoji configuration path - Add tests for numeric and boolean data edge cases * 🧪 test: improve patch coverage for emoji feature - Remove deprecated dead-code methods (getMappings, matchesKeywords) from EmojiSelector - Add tests for unknown log level edge case in EmojiSelector - Add tests for Logger.configure emoji configuration path - Add tests for numeric and boolean data edge cases * 🗑️ remove: delete outdated Snyk security instructions * 🔧 update: address code review feedback on performance and safety Co-authored-by: warengonzaga <15052701+warengonzaga@users.noreply.github.com> --------- Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com> Co-authored-by: warengonzaga <15052701+warengonzaga@users.noreply.github.com> Co-authored-by: Waren Gonzaga <opensource@warengonzaga.com> * 🚀 release: bump version to 2.3.0 * 🗑️ remove: delete repository banner image * 📖 docs: update README with new features and improved descriptions * 📖 docs: update README to format code blocks for emoji log examples * 🔧 update: add LogCallOptions interface and update signatures (#31) * Initial plan * 🔧 update: add LogCallOptions interface and update signatures Co-authored-by: warengonzaga <15052701+warengonzaga@users.noreply.github.com> * 🧪 test: add comprehensive tests for emoji override Co-authored-by: warengonzaga <15052701+warengonzaga@users.noreply.github.com> * 🔧 update: add options parameter to LogEngine wrapper Co-authored-by: warengonzaga <15052701+warengonzaga@users.noreply.github.com> * 🔧 update: address code review feedback Co-authored-by: warengonzaga <15052701+warengonzaga@users.noreply.github.com> * 📖 docs: enhance LogCallOptions JSDoc and add LogEngine wrapper tests Co-authored-by: warengonzaga <15052701+warengonzaga@users.noreply.github.com> * 🔧 update: replace magic numbers with LogMode enum constants Co-authored-by: warengonzaga <15052701+warengonzaga@users.noreply.github.com> --------- Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com> Co-authored-by: warengonzaga <15052701+warengonzaga@users.noreply.github.com> * 🚀 release: bump version to 2.3.1 --------- Co-authored-by: Copilot <198982749+Copilot@users.noreply.github.com> Co-authored-by: warengonzaga <15052701+warengonzaga@users.noreply.github.com>
LogCallOptionsinterface to types/index.ts withemoji?: stringfieldoptionsparameterSummary
Replaced all magic number literals (0, 1) with LogMode enum constants (LogMode.DEBUG, LogMode.INFO) throughout the emoji-override test file for improved readability and consistency with the rest of the test suite. Also fixed comment accuracy regarding log level filtering.
Original prompt
💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.