Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Investigate logging libraries #17

Closed
3 tasks done
LukSteib opened this issue Mar 14, 2023 · 6 comments
Closed
3 tasks done

Investigate logging libraries #17

LukSteib opened this issue Mar 14, 2023 · 6 comments

Comments

@LukSteib
Copy link

LukSteib commented Mar 14, 2023

Goal

Research and decide on best logging library

Context

We want to have an advanced logging library in place that allows to do error and performance logging. More input on original login requirement to inform the research:

should be able to toggle it, at least on a module level > to be plugged in to server logging infrastructure later

First library mentioned and that should be part of the investigation: winston

Tasks

  • Collect possible libraries
  • Propose qualities to make judgment
  • compare, discuss and conclude
@KirillDogadin-std
Copy link
Contributor

KirillDogadin-std commented Mar 15, 2023

@valiafetisov
Copy link
Contributor

As specified in the issue description, main qualities are:

  • Be able to select logging level, enable/disable
  • Be able to enable logging per module (eg prefix and/or glob path support)
  • Be able to plug output to the external service (although this should be possible without a special feature)

From my side I would add ease of use. But if all of the points are covered by winston, I think we can quickly conclude investigation and jump into adding it to the codebase 🙂

@valiafetisov
Copy link
Contributor

Although there are also Pino and other which seem to be of the compared popularity https://www.highlight.io/blog/nodejs-logging-libraries. Maybe you can add them to the comparison as well?

@KirillDogadin-std
Copy link
Contributor

KirillDogadin-std commented Mar 15, 2023

well, to reiterate the above regarding winston specifically and per your latest point:

  • Be able to select logging level, enable/disable ✅
  • Be able to enable logging per module (eg prefix and/or glob path support) ✅
  • Be able to plug output to the external service (although this should be possible without a special feature) ✅
    • (via transport feature)

Maybe you can add them to the comparison as well?

ok will do

@KirillDogadin-std
Copy link
Contributor

added base param comparison: they're all the same,
seem to be equally ez/hard to use
winston leads in gh stars, last updated date. With such small set of things we would like to do with the logging lib, i would just choose winston based on these and the "fact" that the documentation there appears to be of high standard.

@valiafetisov
Copy link
Contributor

I find pino to have a bit simpler interface and zero configuration, they also claim it's faster and have easy integration with express that we're using. One other big advantage I see is that pino works on the frontend as well. So I would try it first. Do you see any problem with that?

If you don't have any arguments against it, let's conclude it until you stumble upon something terrible 🙂

  • Install and configure it
  • Add appropriate info/debug/error/etc logs to the codebase
    • To plain files
    • To http requests
  • Forbid use of console via eslint rule
    • Can you maybe add a custom message to this error, suggesting use of a different library?
  • Add short example usage to the CONTRIBUTING readme (let's create one in the root!)
  • Make sure that in development it's nicely highlighted (ie via pino-pretty)

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

No branches or pull requests

3 participants