From 9cc2da018802ada53c9d3a38e863388c7ae1d65a Mon Sep 17 00:00:00 2001 From: nielm Date: Mon, 18 Nov 2024 11:35:53 +0100 Subject: [PATCH] chore(docs): add links to gcp logging formatter --- docs/ecosystem.md | 1 + docs/help.md | 28 +++++++++++++++++++++++++++- 2 files changed, 28 insertions(+), 1 deletion(-) diff --git a/docs/ecosystem.md b/docs/ecosystem.md index 3c3848168..573891530 100644 --- a/docs/ecosystem.md +++ b/docs/ecosystem.md @@ -81,3 +81,4 @@ prettifier inspired by the [logrus](https://github.com/sirupsen/logrus) logger. + [`pino-lambda`](https://github.com/FormidableLabs/pino-lambda): log transport for cloudwatch support inside aws-lambda + [`cloud-pine`](https://github.com/metcoder95/cloud-pine): transport that provides abstraction and compatibility with [`@google-cloud/logging`](https://www.npmjs.com/package/@google-cloud/logging). + [`crawlee-pino`](https://github.com/imyelo/crawlee-pino): use Pino to log within Crawlee ++ [`@google-cloud/pino-logging-gcp-config`](https://www.npmjs.com/package/@google-cloud/pino-logging-gcp-config): Config helper and formatter to output [Google Cloud Platform Structured Logging](https://cloud.google.com/logging/docs/structured-logging) diff --git a/docs/help.md b/docs/help.md index 383f88873..90f2dd31f 100644 --- a/docs/help.md +++ b/docs/help.md @@ -260,6 +260,32 @@ module.exports = function createLogger(options) { } ``` +A library that configures Pino for +[Google Cloud Structured Logging](https://cloud.google.com/logging/docs/structured-logging) +is available at: +[@google-cloud/pino-logging-gcp-config](https://www.npmjs.com/package/@google-cloud/pino-logging-gcp-config) + +This library has the following features: + ++ Converts Pino log levels to Google Cloud Logging log levels, as above ++ Uses `message` instead of `msg` for the message key, as above ++ Adds a millisecond-granularity timestamp in the + [structure](https://cloud.google.com/logging/docs/agent/logging/configuration#timestamp-processing) + recognised by Google Cloud Logging eg: \ + `"timestamp":{"seconds":1445470140,"nanos":123000000}` ++ Adds a sequential + [`insertId`](https://cloud.google.com/logging/docs/reference/v2/rest/v2/LogEntry#FIELDS.insert_id) + to ensure log messages with identical timestamps are ordered correctly. ++ Logs including an `Error` object have the + [`stack_trace`](https://cloud.google.com/error-reporting/docs/formatting-error-messages#log-error) + property set so that the error is forwarded to Google Cloud Error Reporting. ++ Includes a + [`ServiceContext`](https://cloud.google.com/error-reporting/reference/rest/v1beta1/ServiceContext) + object in the logs for Google Cloud Error Reporting, auto detected from the + environment if not specified ++ Maps the OpenTelemetry properties `span_id`, `trace_id`, and `trace_flags` + to the equivalent Google Cloud Logging fields. + ## Using Grafana Loki to evaluate pino logs in a kubernetes cluster @@ -316,4 +342,4 @@ if you have broader logging requirements. ## Testing -See [`pino-test`](https://github.com/pinojs/pino-test). \ No newline at end of file +See [`pino-test`](https://github.com/pinojs/pino-test).