From 4d53b7e6768350e7791563dff45e2ccf5d3cc586 Mon Sep 17 00:00:00 2001 From: Jhon Mosk <40711760+Jhon-Mosk@users.noreply.github.com> Date: Fri, 6 Sep 2024 13:22:31 +0300 Subject: [PATCH 1/2] Update transports.md add transport for yandex cloud logging --- docs/transports.md | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) diff --git a/docs/transports.md b/docs/transports.md index fbf423e03..108d8d7d3 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 @@ -1089,6 +1090,33 @@ const logger = pino({ logger.error('test log!'); ``` + +### 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"); +``` + The `extra` parameter is optional. Parameters that the method [`sendMessage`](https://core.telegram.org/bots/api#sendmessage) supports can be passed to it. From e1af72000d848a9e7c02bd0964c8ae2b59fbfd82 Mon Sep 17 00:00:00 2001 From: Jhon Mosk <40711760+Jhon-Mosk@users.noreply.github.com> Date: Fri, 6 Sep 2024 16:21:46 +0300 Subject: [PATCH 2/2] Update transports.md fix description --- docs/transports.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/transports.md b/docs/transports.md index 108d8d7d3..b1411491a 100644 --- a/docs/transports.md +++ b/docs/transports.md @@ -1090,6 +1090,8 @@ const logger = pino({ 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 @@ -1117,8 +1119,6 @@ logger.error(new Error("error")); logger.fatal("fatal"); ``` -The `extra` parameter is optional. Parameters that the method [`sendMessage`](https://core.telegram.org/bots/api#sendmessage) supports can be passed to it. - ## 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).