Refactor: Extract helper method to reduce code duplication in Logger class#22
Conversation
|
@copilot submit the PR to |
Co-authored-by: warengonzaga <15052701+warengonzaga@users.noreply.github.com>
Co-authored-by: warengonzaga <15052701+warengonzaga@users.noreply.github.com>
I cannot directly change the base branch of an existing PR from
Which approach would you prefer? |
warengonzaga
left a comment
There was a problem hiding this comment.
Looks good, alright will add this to the dev branch.
|
@copilot resolve the conflict, priority is the |
…le adding format customization
Merge conflicts resolved successfully! The dev branch has been merged while preserving the helper method refactoring. The solution combines both improvements: reduced code duplication through the Warning Firewall rules blocked me from connecting to one or more addressesI 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 ReportAll modified and coverable lines are covered by tests ✅ 📢 Thoughts on this report? Let us know! |
Summary
This PR addresses a code review feedback by extracting repeated formatting logic into a reusable helper method, significantly improving code maintainability and readability in the Logger class.
Problem
The review feedback identified repetitive code across all logging methods:
Each of the following methods contained nearly identical formatting logic:
debug(),info(),warn(),error(),log()debugRaw(),infoRaw(),warnRaw(),errorRaw(),logRaw()Solution
Extracted the common formatting pattern into a private helper method:
Now all logging methods use the cleaner pattern:
Benefits
Testing
Review Context
This change directly addresses the Copilot review comment:
The refactoring maintains all existing functionality while significantly improving code quality and maintainability.
Warning
Firewall rules blocked me from connecting to one or more addresses
I tried to connect to the following addresses, but was blocked by firewall rules:
api.example.com/usr/local/bin/node /home/REDACTED/work/log-engine/log-engine/node_modules/jest-worker/build/workers/processChild.js(dns block)downloads.snyk.ionode wrapper_dist/bootstrap.js exec(dns block)https://api.github.com/repos/wgtechlabs/log-engine/pulls/21.patchcurl -s REDACTED(http block)o30291.ingest.sentry.ionode wrapper_dist/bootstrap.js exec(dns block)static.snyk.ionode wrapper_dist/bootstrap.js exec(dns block)If you need me to access, download, or install something from one of these locations, you can either:
💡 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.