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.
Can you explain more? I do realize the existence of Morgan and Winston, though.
There is also pino-debug, but I don't see it as helpful. Too much non-useful information.
Too much text, and it will be trimmed.
Have you tried, something like this. The error log size will destroy console output in VSCode. I believe it won't destroy chrome://inspect, though. (I edited the main post on how I made it work.)
I deployed my Docker container on Google Cloud Run. The rest is fully managed by Google.
GCR dashboard looks like this,
There seems to be no error message shown, even if the status is 500.
However, I am also asking about logging in development settings, e.g. localhost.
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.
I use
fastify
which usespino
, which automatically log to console; but this can easily be a bad idea.--inspect
flag yet.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"?When I develop in Node.js I log request/responses locally with debug and morgan/winston packages. They require little setup and work well for me.
Can you explain more? I do realize the existence of Morgan and Winston, though.
There is also pino-debug, but I don't see it as helpful. Too much non-useful information.
Have you tried, something like this. The error log size will destroy console output in VSCode. I believe it won't destroy
chrome://inspect
, though. (I edited the main post on how I made it work.)