Add context-aware emoji support to log output#26
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>
There was a problem hiding this comment.
Pull request overview
This PR adds an opt-in, context-aware emoji feature to the log formatting pipeline, allowing log lines to include an emoji selected from message/data content (with level-based fallback emoji) while preserving backward compatibility by keeping the feature disabled by default.
Changes:
- Introduces
EmojiSelectorplus curatedEMOJI_MAPPINGSandFALLBACK_EMOJIfor context and fallback selection. - Extends
LogFormatConfigwithemoji?: EmojiConfigand exports the new emoji types/utilities via the public API. - Updates
MessageFormatteroutput format to include[EMOJI]between[LEVEL]and: message, and adds unit/integration tests + README documentation.
Reviewed changes
Copilot reviewed 9 out of 9 changed files in this pull request and generated 8 comments.
Show a summary per file
| File | Description |
|---|---|
| src/types/index.ts | Adds EmojiConfig/EmojiMapping and plugs emoji config into LogFormatConfig. |
| src/index.ts | Re-exports emoji types and formatter utilities as part of the public API. |
| src/formatter/message-formatter.ts | Integrates emoji selection into formatted output and wires formatter config into EmojiSelector. |
| src/formatter/index.ts | Exposes emoji selector and emoji data from the formatter barrel. |
| src/formatter/emoji-selector.ts | Implements the selection engine (message/data analysis + fallbacks). |
| src/formatter/emoji-data.ts | Provides curated default mappings and level-based fallback emoji. |
| src/tests/emoji.test.ts | Unit tests for selector behavior, config, fallbacks, and edge cases. |
| src/tests/emoji-integration.test.ts | Integration tests ensuring emoji appear in the final formatted log output. |
| README.md | Documents emoji feature usage, configuration, and output format. |
|
@copilot apply changes based on the comments in this thread |
Co-authored-by: warengonzaga <15052701+warengonzaga@users.noreply.github.com>
Applied all changes from the review feedback in commit c7d958f: ✅ Fixed All tests passing (324/324), build successful. 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:
|
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
Copilot reviewed 11 out of 11 changed files in this pull request and generated 4 comments.
Comments suppressed due to low confidence (1)
src/formatter/message-formatter.ts:27
- The JSDoc for
MessageFormatter.formatstill describes the output format as[ISO_TIMESTAMP][LOCAL_TIME][LEVEL]: ..., but emoji are now included by default (includeEmoji: true) and the formatter can produce[...][LEVEL][EMOJI]: .... Please update the comment so it matches the actual output format(s), including howincludeEmoji: falseaffects it.
includeEmoji: true
};
/**
* Formats a log message with timestamp, level indicator, and appropriate coloring
|
@copilot apply changes based on the comments in this thread |
Codecov Report❌ Patch coverage is
📢 Thoughts on this report? Let us know! |
Co-authored-by: warengonzaga <15052701+warengonzaga@users.noreply.github.com>
Co-authored-by: warengonzaga <15052701+warengonzaga@users.noreply.github.com>
- 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 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
…com/wgtechlabs/log-engine into copilot/add-context-aware-emoji-log
|
@copilot apply changes based on the comments in this thread |
Co-authored-by: warengonzaga <15052701+warengonzaga@users.noreply.github.com>
|
Just as a heads up, I was blocked by some firewall rules while working on your feedback. Expand below for details. 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:
|
* 📦 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 --------- Co-authored-by: Copilot <198982749+Copilot@users.noreply.github.com> Co-authored-by: warengonzaga <15052701+warengonzaga@users.noreply.github.com>
* 📦 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>
Implements intelligent emoji selection for log messages based on content analysis, with fallback to level-specific defaults. Feature is enabled by default to enhance log readability.
Changes
Emoji Selection Engine (
emoji-selector.ts)Configuration (
types/index.ts)EmojiConfiginterface supports custom mappings, fallback overrides, and exclusive modeLogFormatConfig.emojifor customizationincludeEmoji?: booleanflag (defaults totrue) for enable/disable controlOutput Format
MessageFormatterto inject emoji between level and message:[LEVEL][EMOJI]: messagePerformance Optimizations
Security & Type Safety
Object.prototype.hasOwnProperty.call()customFallbacksusesPartial<Record<'DEBUG' | 'INFO' | 'WARN' | 'ERROR' | 'LOG', string>>Usage
Context Mappings
Fallback emoji: DEBUG 🐞, INFO ℹ️, WARN⚠️ , ERROR ❌, LOG ✅
Exports
Added to public API:
EmojiSelector,EmojiConfig,EmojiMapping,EMOJI_MAPPINGS,FALLBACK_EMOJIBreaking Change
This is a breaking change - emoji are now enabled by default. Users who want the previous behavior (no emoji) must explicitly set
format: { includeEmoji: false }in their configuration.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.