From 0ab1bdd258acd00f82103206f385e4525010a8ff Mon Sep 17 00:00:00 2001 From: Jhon Mosk <40711760+Jhon-Mosk@users.noreply.github.com> Date: Wed, 11 Sep 2024 13:13:05 +0300 Subject: [PATCH] Update transports.md (#2041) * Update transports.md add transport for yandex cloud logging * Update transports.md fix description --- docs/transports.md | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) diff --git a/docs/transports.md b/docs/transports.md index fbf423e03..b1411491a 100644 --- a/docs/transports.md +++ b/docs/transports.md @@ -425,6 +425,7 @@ PRs to this document are welcome for any new transports! + [pino-discord-webhook](#pino-discord-webhook) + [pino-logfmt](#pino-logfmt) + [pino-telegram-webhook](#pino-telegram-webhook) ++ [pino-yc-transport](#pino-yc-transport) ### Legacy @@ -1091,6 +1092,33 @@ logger.error('test log!'); The `extra` parameter is optional. Parameters that the method [`sendMessage`](https://core.telegram.org/bots/api#sendmessage) supports can be passed to it. + +### pino-yc-transport + +[pino-yc-transport](https://github.com/Jhon-Mosk/pino-yc-transport) is a Pino v7+ transport for writing to [Yandex Cloud Logging](https://yandex.cloud/ru/services/logging) from serveless functions or containers. + +```js +const pino = require("pino"); + +const config = { + level: "debug", + transport: { + target: "pino-yc-transport", + }, +}; + +const logger = pino(config); + +logger.debug("some message") +logger.debug({ foo: "bar" }); +logger.debug("some message %o, %s", { foo: "bar" }, "baz"); +logger.info("info"); +logger.warn("warn"); +logger.error("error"); +logger.error(new Error("error")); +logger.fatal("fatal"); +``` + ## Communication between Pino and Transports Here we discuss some technical details of how Pino communicates with its [worker threads](https://nodejs.org/api/worker_threads.html).