Skip to content

refactor: modernize log utilities with ES6 classes and syntax#2274

Open
Puxhkar wants to merge 1 commit into
remy:mainfrom
Puxhkar:modernize-log-utils
Open

refactor: modernize log utilities with ES6 classes and syntax#2274
Puxhkar wants to merge 1 commit into
remy:mainfrom
Puxhkar:modernize-log-utils

Conversation

@Puxhkar

@Puxhkar Puxhkar commented Mar 23, 2026

Copy link
Copy Markdown

Description

This PR modernizes the lib/utils/log.js module by refactoring it to use ES6 classes and modern JavaScript syntax (ES6+). These changes improve code readability and maintainability while ensuring full backward compatibility with the existing codebase.

Changes

  • ES6 Class Refactor: Converted the legacy Logger constructor and prototype-based methods into a modern class Logger structure.
  • Modern Syntax Adoption:
    • Replaced var with const and let for improved scoping.
    • Adopted template literals for cleaner and more readable string construction.
    • Used arrow functions for more concise callbacks.
    • Used shorthand property names in object literals.
  • Code Cleanup: Removed legacy architectural "question" comments to streamline the source code.
  • Backward Compatibility: Maintained the factory function export pattern. This ensures that internal consumers calling the module as a function (e.g., require('./log')(val)) continue to function without modification.

Verification

  • Linting: Passed npm run lint with no issues.
  • Automated Tests: Verified that test/config/load-logging.test.js passes, confirming that logging configuration remains intact.
  • Manual Testing: Verified both the factory function and the class constructor directly to ensure output formatting, color support, and debug toggling work as expected.

@netlify

netlify Bot commented Mar 23, 2026

Copy link
Copy Markdown

Deploy Preview for nodemon ready!

Name Link
🔨 Latest commit 86412a3
🔍 Latest deploy log https://app.netlify.com/projects/nodemon/deploys/69c0e99da8e59c0008a32c75
😎 Deploy Preview https://deploy-preview-2274--nodemon.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant