question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Feature Request: [Feature] Consider expanding tslog so that it can become the go to logging framework for Node

See original GitHub issue

Winston and Pino are both written in JS with minimal to no typings. Winston is limping on but gets no real attention from the maintainers, it also can’t do basic things such as logging metadata to the console in certain scenarios (such as pretty printing). Both lack real world “enterprise” grade logging features that other languages/ecosystems have available.

The one feature they both have that tslog does not have though, is dedicated transports for log files. If tslog could be extended to support such capabilities that other logging frameworks have such as:

  • File transport
  • File rotation
  • Archiving log files to .zip file

Then I think tslog would be positioned in a really nice place. Currently the choice comes down to either picking Winston and having little chance of fixes or new features, or Pino and having no official typings (and also all the docs are still showing require in 2022). I personally believe tslog can be the basis for a modern logging framework if it adds official file transport. The community could contribute the other types of transports they desire such as databases etc.

I know the docs show an example of logging to a file but it doesn’t have retries, buffering, or log file rotation like a real world one would. Developers may not be comfortable developing their own safe file transport as it’s not a simple task and has edge cases and unit testing to consider. IF tslog provides this out of the box, developers and organisations could use tslog immediately.

What do you think? Maybe sponsorship of the library could help develop this?

Issue Analytics

  • State:closed
  • Created a year ago
  • Reactions:3
  • Comments:5 (4 by maintainers)

github_iconTop GitHub Comments

2reactions
terehovcommented, Jul 8, 2022

Hello @lloydjatkinson

thank you very much for your kind words. I am indeed looking to allocate more time to tslog and already started working on version 4.0. For now it has only been a side project of mine, but I’ve been thinking of ways to change that and feedback like yours is super valuable. Are you open to discuss it directly? Would be great to hear your experiences.

PS: I indeed thought about adding a donation button.

1reaction
lloydjatkinsoncommented, Jul 8, 2022

Hi, that’s great to hear! It’s a really good effort for saying it’s a side project 😀

Yep I’m free to discuss this any time that suits you! In the meantime I also found this https://www.npmjs.com/package/rotating-file-stream which seems to be very well tested and also written in TS. Perhaps this could be used for the transport?

Edit: It’s also worth mentioning having console and file transport usually implies possibly different verbosity/format/levels per transport. For example logging everything to a file in json format but only logging warn and error and fatal to console in pretty format.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Question: Rename Silly to Step via Config? #77 - GitHub
I'm designing an automation framework that will be using your logging library (great work btw!). I'd like to use the silly level as...
Read more >
tslog - Extensible TypeScript Logger for Node.js and Browser ...
Extensible TypeScript Logger for Node.js and Browser: Dependency free, Fully customizable, Pretty errors, stack traces, and JSON output to attachable ...
Read more >
Node Logging Basics - The Ultimate Guide To Logging - Loggly
Node Logging Basics. Node provides an easily extensible logging system, allowing you to control which messages get logged and to where they are...
Read more >
11 Best Practices for Logging in Node.js - Better Stack
This article describes 11 best practices to follow when logging in Node.js to produce high quality logs that will help you keep your ......
Read more >
tslog - npm
Extensible TypeScript Logger for Node.js and Browser: Dependency free, Fully customizable, Pretty errors, stack traces, and JSON output to ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found