Skip to content

Commit

Permalink
Update transports.md (#1993)
Browse files Browse the repository at this point in the history
* Update transports.md

Add pino-telegram-webhook transport for send message to Telegram

* Update transports.md

correcting grammatical errors
  • Loading branch information
Jhon-Mosk authored Jun 24, 2024
1 parent ba6260b commit a41b4d3
Showing 1 changed file with 28 additions and 0 deletions.
28 changes: 28 additions & 0 deletions docs/transports.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -1063,6 +1064,33 @@ const logger = pino({
})
```
<a id="pino-telegram-webhook"></a>
### 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('<b>test log!</b>');
```
The `extra` parameter is optional. Parameters that the method [`sendMessage`](https://core.telegram.org/bots/api#sendmessage) supports can be passed to it.
<a id="communication-between-pino-and-transport"></a>
## 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).
Expand Down

0 comments on commit a41b4d3

Please sign in to comment.