Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update transports.md #1993

Merged
merged 2 commits into from
Jun 24, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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