diff --git a/docs/transports.md b/docs/transports.md index 859d7c325..07f47cfb2 100644 --- a/docs/transports.md +++ b/docs/transports.md @@ -424,6 +424,7 @@ PRs to this document are welcome for any new transports! + [@axiomhq/pino](#@axiomhq/pino) + [pino-discord-webhook](#pino-discord-webhook) + [pino-logfmt](#pino-logfmt) ++ [pino-telegram-webhook](#pino-telegram-webhook) ### Legacy @@ -1063,6 +1064,33 @@ const logger = pino({ }) ``` + +### pino-telegram-webhook + +[pino-telegram-webhook](https://github.com/Jhon-Mosk/pino-telegram-webhook) is a Pino v7+ transport for sending messages to [Telegram](https://telegram.org/). + +```js +const pino = require('pino'); + +const logger = pino({ + transport: { + target: 'pino-telegram-webhook', + level: 'error', + options: { + chatId: -1234567890, + botToken: "123456:ABC-DEF1234ghIkl-zyx57W2v1u123ew11", + extra: { + parse_mode: "HTML", + }, + }, + }, +}) + +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. + ## 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).