Skip to content

Replace simple-node-logger with pino for Node 24 compatibility#62

Open
Pratheek555 wants to merge 7 commits intoRocketChat:masterfrom
Pratheek555:nativeLoggerImplementation
Open

Replace simple-node-logger with pino for Node 24 compatibility#62
Pratheek555 wants to merge 7 commits intoRocketChat:masterfrom
Pratheek555:nativeLoggerImplementation

Conversation

@Pratheek555
Copy link

Summary

This PR replaces simple-node-logger usage with a native in-repo logger implementation in src/misc/logger.ts.

Fixes

#61

Why

simple-node-logger is causing runtime compatibility issues on modern Node versions (notably Node 24), including crashes from deprecated/removed Node util APIs.
Switching to a small native logger removes that runtime risk and avoids external logger dependency behavior.

What changed

  • Implemented NativeLogger with:
    • setLevel() support
    • level filtering (trace, debug, info, warn, error, fatal)
    • debug, info, warn, error methods
  • Added timestamped log output format:
    • [YYYY-MM-DD HH:mm:ss.SSS] LEVEL ...args
  • Preserved existing default behavior:
    • log level is initialized from process.env.LOG_LEVEL (defaulting to info)

The below logs were obtained while trying to compile a rocketchat app.

Before logs: (ran by switching node version to 20)

image

After Logs : (the new native logger)

image

Validation

  • npx eslint src/**/*.ts passes
  • Logger API surface used by compiler code (debug, info, warn, error, setLevel) remains available

@Pratheek555 Pratheek555 changed the title Native logger implementation Replace simple-node-logger with native logger for Node 24 compatibility Feb 28, 2026
Copy link
Member

@KevLehman KevLehman left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just use pino or a log library, no need to reinvent the wheel

@Pratheek555
Copy link
Author

Just use pino or a log library, no need to reinvent the wheel

yes sir, I already have it implemented in another branch. Will push the code in sometime.

thank you!

@Pratheek555 Pratheek555 changed the title Replace simple-node-logger with native logger for Node 24 compatibility Replace simple-node-logger with pino for Node 24 compatibility Feb 28, 2026
@Pratheek555
Copy link
Author

Hey @KevLehman

I have implemented pino with pino-pretty. The below shows the demonstration of the logs while compiling an app. Please do let me know if any changes are required.

image

Thank you for your time!

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.

3 participants