Skip to content

Conversation

@avi-dev-user
Copy link

No description provided.

@ShlomoCode
Copy link
Owner

Thank you for your contribution!
However, I think adding timestamps at the library level isn’t necessary, since standard runtime orchestrator like Kubernetes, Docker, systemd, PM2 already attach precise timestamps to each log line.
Keeping this responsibility outside the library also allows more flexibility in formatting, localization, and integration with different logging systems.

@ShlomoCode ShlomoCode closed this Nov 6, 2025
@ShlomoCode
Copy link
Owner

If you want, you can achieve this by overriding console.log

@avi-dev-user
Copy link
Author

Thanks for the quick response!

I made this opt-in (default: false) specifically because I agree orchestrators handle timestamps well in most cases.

However, we observed a real need in our company: when library logs mix with application logs in aggregated systems, having embedded timestamps makes troubleshooting significantly faster. Overriding console.log globally isn't practical for us since it affects the entire process and conflicts with other libraries.

The implementation is minimal and doesn't impact existing users. Happy to rework it as a custom logger hook if you prefer that approach instead.

@ShlomoCode
Copy link
Owner

ShlomoCode commented Nov 7, 2025

I'm wondering whether to add a logger option (that accepts a function), or to add it to the existing events mechanism.

@ShlomoCode ShlomoCode reopened this Nov 9, 2025
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.

2 participants