Spoke
Spoke copied to clipboard
Feature Request: Consolidation of logging into specific guidance
Problem
We currently have a few different logging frameworks and not a lot of guidance on how to use them. There are console.log
s used on frontend and backend, and there's an env var for rollbar.
Solution It'd be great to introduce a solid standard for backend logging to help sys admin have clearer logs and to give devs an idea of how to introduce logging. I'd like to see rollbar removed and I'd like to see a framework become the one and only logger for the backend. I'd like to propose:
- Pino to be the new backend logger and log calls be converted to JSON
- All frontend logs stay console.logs but be kept to a minimum
- After all of this is in and settled, remove rollbar
Context One thing to watch out for with Pino as the logger is some backwards compatibility risks of JSON logging implications. It might take more energy changing all the log statements to be structured. All logging that we have in the backend should stay in place, but be modified to fit Pino or another framework's structure.
@matteosb anything to add?
I personally think json logging with pino is the way to go, but I think there is a good argument for going with Winston because of its configurable transports. For example, Rollbar support could be implemented as a transport. It really depends on the needs of the community.
FWIW GetUp does use Rollbar, and we'd like to keep on using that or a similar service to log server-side messages and error alerting.
@michael-gratton this issue was never picked up and is pretty old, but I'd love to get it to a place where it could be compatible with GetUp's needs.
Just to be clear here: you said
we'd like to keep on using that or a similar service
and I'm wondering if your ideal scenario would be: 1. Make no logging changes -- certainly the easiest option 2. Keep rollbar specifically as a backend logger -- then write up some docs on when to use rollbar and when to use console logs and maybe remove some other backend logging? Wondering if we could standardize all our logging on rollbar (would love your input on that if you all have an answer) 3. Some ambivalence about rollbar vs a "similar service" -- In which case, it would be helpful to know would be important in a "similar service" to help reword the proposal.
I'm no logging connoisseur or expert. This idea initially came from a conversation with @matteosb and I do agree that standardizing logging in the app (or at least having docs to help people know what choices to make going forward without rewriting old stuff) would be helpful for debugging an clarity.