googleapis / nodejs-logging-bunyan

Node.js client integration between Stackdriver Logging and Bunyan.
https://cloud.google.com/logging/
Apache License 2.0
63 stars 34 forks source link

Error Reporting does not work when `redirectToStdout` is set #684

Closed tkgreg closed 1 year ago

tkgreg commented 1 year ago

My app is running in GKE. Instead of using approach with Logging API I decided to use the simple redirectToStdout with serviceContext config. Unfortunately, it didn't work out. When I call logger.error it doesn't report to Error Reporting. Any suggestions how to solve it?

tkgreg commented 1 year ago

I've checked again and it looks like it works only if I pass new Error instance to logger.error(...). If I pass a string it does not trigger Error Reporting API. Is it expected behaviour by design or a bug?

losalex commented 1 year ago

@tkgreg, here described how to format error in logs, but I believe you might not be able to set @type field, thus adding new Error is probably the way for now. More related info can be found 754. Turning this issue into feature request for future tracking.

losalex commented 1 year ago

Closing this one as a duplicate of 754.