On Google Cloud, when using a GAE or a cloud function in nodejs, we can log to stackdriver directly via stdout, as they explain here as follows:
Note: Logs written to stdout and stderr are automatically sent to Stackdriver Logging for you, without needing to use the Stackdriver Logging libraries for Node.js.
Is it possible to add structure to these logs? Like jsonPayload
?
I would love to avoid client libraries, if possible.
App Engine and Cloud Functions both listen to std and can directly log to Stackdriver. The recommended approach for further customization is to directly use the client library instead of logging to std. For now, you can add structure to your Stackdriver logging using the jsonPayload field but the call will still need to go through the client libraries. Please check the following article for reference. I have already created a feature request for you on Google Issue Tracker so that it might help you get the feature that you have requested.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With