Skip to content
This repository was archived by the owner on Feb 7, 2026. It is now read-only.
This repository was archived by the owner on Feb 7, 2026. It is now read-only.

FR: Logging provider for Cloud Functions that outputs structured logs to process.stdout #536

@nielm

Description

@nielm

Google Cloud Functions automatically capture stdout (and stderr), and send them to cloud logging.

It is possible to output structured JSON log records to stdout, which are processed by cloud logging to map to the Logging special fields

An advantage of logging to process.stdout in cloud functions is that the function's execution_id is added to the logging to link function invocations (while this is accessible in HTTP cloud functions, but not from Pub/Sub or Cloud Event background functions.
A second advantage is that as this does not use the Logging API there does not need to be an IAM/Auth for the cloud function's service account.

A useful feature would be a separate logging provider which instead of logging via the Cloud Logging API, instead logs to process.stdout with the structured JSON record expected by GCP.

Alternatives:
Write my own logging wrapper that creates JSON structured logs.... yuk.

Screenshot from cloud logging attached showing 2 identical logs from a cloud function - the first is from via the Bunyan logging provider for GCP which logs via cloud logging API, the second is with bunyan streaming to process.stdout -- its the raw log message, but cloud logging links the function invocation ID, and gives the ability to trace all logs for the function.

viMERDoQEn9vTYW

Metadata

Metadata

Assignees

Labels

api: loggingIssues related to the googleapis/nodejs-logging-bunyan API.priority: p2Moderately-important priority. Fix may not be included in next release.type: feature request‘Nice-to-have’ improvement, new feature or different behavior or design.

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions