-
-
Notifications
You must be signed in to change notification settings - Fork 1
Description
Motivation
Enhance the expressiveness and clarity of logs by adding context-aware emojis to each log message. Emoji help users visually parse large logs and instantly spot the type or intent of a log line, making debugging and operations more intuitive.
Proposed Feature & Behavior
-
Context-Aware Emoji Engine:
- Implement an algorithm that analyzes the log context (log level + message content) and assigns the most relevant emoji for that line.
- The emoji selection should leverage a rich set of common terminal/commit emojis. We recommend starting from the gitmoji set (see their API and JSON export for emoji+descriptions mapping).
- Typical mappings might be:
- "fix", "bug", "error" → 🐛, ❌, 🚑️
- "deploy" → 🚀
- "performance" → ⚡️
- "security" → 🔒️
- "database" → 🗃️
- ... (see gitmoji set for more)
-
Fallback to Pre-Defined Defaults:
- If no suitable emoji is detected via the context, fallback to one of 5 persistent emoji, mapped to the log level (e.g.,
- DEBUG 🐞
- INFO ℹ️
- WARN
⚠️ - ERROR ❌
- LOG ✅
)
- This guarantees every log line is visually decorated, even if the message/context is unknown.
- If no suitable emoji is detected via the context, fallback to one of 5 persistent emoji, mapped to the log level (e.g.,
-
User Extensibility:
- Allow users to customize, extend, or override emoji mappings and context rules (e.g., via configuration object).
-
Output Format:
- Add the emoji as a new element after the log status:
[<STATUS>][<EMOJI>]: text...
- Add the emoji as a new element after the log status:
Implementation Tips
- Use the
gitmojis.jsonfrom https://gitmoji.dev/api/gitmojis as a reference for the emoji set and descriptions. - Match log context by mapping keywords in the message (and optionally data) against the gitmoji descriptions.
- Provide a helper for users to supply their own context rules or mappings.
- If needed, include a list of the fallback emoji in docs, and reference the API for the up-to-date set.
Example
logger.error('Critical database failure');
// [ERROR][🗃️]: Critical database failure
logger.info('Deployed successfully');
// [INFO][🚀]: Deployed successfully
logger.warn('Performance dropping');
// [WARN][⚡️]: Performance dropping
logger.debug('Step into function');
// [DEBUG][🐞]: Step into function
logger.info('Unknown event happened');
// [INFO][ℹ️]: Unknown event happened (fallback)Resources
Summary:
- Use context-aware emoji if possible, fallback to default level emoji otherwise.
- Start with gitmoji set for context mapping.
- Output format is
[<STATUS>][<EMOJI>]: message ... - Allow user extensibility to customize rules or add emoji.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels
Type
Projects
Status
Done