DEV Community

Discussion on: Logging REST API

Collapse
 
ale_jacques profile image
Alexandre Jacques

On localhost, I usually don't log stuff, I debug. By that I mean using the debugger to view variable content, bodies, etc. inside my code. Eventually, I console.log() (or whatever your language console method is) things if I feel debugging is not necessary.

But that's MY workflow. If its for development stuff, I wouldn't worry much if I'm bloating my local server as I could easily delete logs.

Maybe I missunderstood what you're trying to do. :)

I don't know if you're already using but I'll leave here for reference for other people: Google Cloud Run has a logging feature: cloud.google.com/run/docs/logging.

Thread Thread
 
patarapolw profile image
Pacharapol Withayasakpunt • Edited

I use fastify which uses pino, which automatically log to console; but this can easily be a bad idea.

  • Too much text, and it will be trimmed.
  • Not using advantage of Chrome DevTools. Haven't tried --inspect flag yet.
  • Maybe logged history of a session inside a temporary database would be helpful?

Also, of course, I don't know how to make pino work well with GCR. As far as I read the guide, it still requires a decision of "what to log"?