-
-
Notifications
You must be signed in to change notification settings - Fork 1
Migrate console logging to @wgtechlabs/log-engine and remove emojis from logs #46
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Migrate console logging to @wgtechlabs/log-engine and remove emojis from logs #46
Conversation
Co-authored-by: warengonzaga <[email protected]>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR migrates the logging system from a custom implementation to @wgtechlabs/log-engine
v2.2.0 while removing emojis from all log messages to achieve a cleaner output format showing only error type and local time.
- Replaced custom logger implementation with
@wgtechlabs/log-engine
integration - Removed 18 emoji instances from log messages across event handlers
- Implemented custom output handler to format logs as
[HH:MM:SS][LEVEL]: message
Reviewed Changes
Copilot reviewed 5 out of 6 changed files in this pull request and generated 2 comments.
Show a summary per file
File | Description |
---|---|
src/utils/logger.js |
Complete migration to @wgtechlabs/log-engine with custom output formatting |
src/events/threadCreate.js |
Removed emojis (❌, |
src/events/ready.ts |
Removed emojis ( |
src/events/ready.js |
Removed emojis ( |
package.json |
Added @wgtechlabs/[email protected] dependency |
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
const messageMatch = cleanMessage.match(/^.*?\[.*?\].*?\[.*?\].*?\[.*?\]:\s*(.*)$/); | ||
if (messageMatch && messageMatch[1]) { | ||
cleanMessage = messageMatch[1].trim(); | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The regex pattern for extracting message content is fragile and may break if the log-engine's internal format changes. Consider using a more robust parsing approach or documenting the dependency on this specific format.
// This approach splits at the first occurrence of ']:', which should follow the last prefix. | |
// If the log-engine's format changes, update this logic accordingly. | |
const splitIndex = cleanMessage.indexOf(']:'); | |
if (splitIndex !== -1) { | |
cleanMessage = cleanMessage.slice(splitIndex + 2).trim(); |
Copilot uses AI. Check for mistakes.
cleanMessage = messageMatch[1].trim(); | ||
|
||
// Remove any JSON data that might be appended to the message | ||
cleanMessage = cleanMessage.replace(/\s*\{.*\}$/, ''); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This regex removes all JSON-like content at the end of messages, which could accidentally remove legitimate log data. Consider a more precise approach to handle data parameters or document this limitation.
cleanMessage = cleanMessage.replace(/\s*\{.*\}$/, ''); | |
// (Removed imprecise regex that stripped JSON-like content from the end of the message) | |
// cleanMessage = cleanMessage.replace(/\s*\{.*\}$/, ''); |
Copilot uses AI. Check for mistakes.
@copilot I can still see some legacy code for the console log, can we completely remove them and use the @wgtechlabs/log-engine purely here? Use the logger.ts as the configuration file instead no more legacy code for logging in console. |
…bs/log-engine Co-authored-by: warengonzaga <[email protected]>
Done! I've completely removed all legacy console logging code from
Commit: 3bd08b1 |
This PR migrates the console logging system from a custom implementation to
@wgtechlabs/log-engine
v2.2.0, implementing a clean, emoji-free logging format that shows only error type and local time as requested.Changes Made
🔧 Complete Logger Migration
src/utils/logger.js
andsrc/utils/logger.ts
from custom console logging to@wgtechlabs/log-engine
@wgtechlabs/[email protected]
to package.json🧹 Clean Output Format
The new logging format follows the requirements exactly:
Before:
After:
🚫 Emoji Removal
Removed all emojis from logging calls across the codebase:
src/events/ready.js
&src/events/ready.ts
: Removedsrc/events/threadCreate.js
: Removed ❌,Total: 18 emoji instances removed across 4 files
🔄 Unified Implementation
debug
,info
,warn
,error
) work unchangedDEBUG_MODE
environment variable continues to control debug log visibility🧪 Technical Implementation
Testing
This migration follows KISS (Keep It Simple, Stupid) and Clean Code principles, providing a modern, secure logging solution while maintaining the exact output format requirements and completely eliminating all legacy console logging code.
✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.