@logtape/sentry
Version:
LogTape Sentry Sink
87 lines (65 loc) • 2.02 kB
Markdown
@logtape/sentry: LogTape Sentry Sink
====================================
[![JSR][JSR badge]][JSR]
[![npm][npm badge]][npm]
[![GitHub Actions][GitHub Actions badge]][GitHub Actions]
This package provides an [Sentry] sink for [LogTape]. It allows you to
capture your LogTape logs and send them to Sentry.

[]: https://jsr.io/@logtape/sentry
[]: https://jsr.io/badges/@logtape/sentry
[]: https://www.npmjs.com/package/@logtape/sentry
[]: https://img.shields.io/npm/v/@logtape/sentry?logo=npm
[]: https://github.com/dahlia/logtape-sentry/actions/workflows/main.yaml
[]: https://github.com/dahlia/logtape-sentry/actions/workflows/main.yaml/badge.svg
[]: https://sentry.io/
[]: https://logtape.org/
Installation
------------
The package is available on [JSR] and [npm].
~~~~ bash
deno add @logtape/sentry
npm add @logtape/sentry
pnpm add @logtape/sentry
yarn add @logtape/sentry
bun add @logtape/sentry
~~~~
Usage
-----
The quickest way to get started is to use the `getSentrySink()` function
without any arguments:
~~~~ typescript
import { configure } from "@logtape/logtape";
import { getSentrySink } from "@logtape/sentry";
await configure({
sinks: {
sentry: getSentrySink(),
},
filters: {},
loggers: [
{ category: [], sinks: ["sentry"], level: "debug" },
],
});
~~~~
If you want to explicitly configure the Sentry client, you can pass the
`Client` instance to the `getSentrySink()` function:
~~~~ typescript
import { configure } from "@logtape/logtape";
import { init } from "@sentry/node";
const client = init({
dsn: process.env.SENTRY_DSN,
});
await configure({
sinks: {
sentry: getSentrySink(client),
},
filters: {},
loggers: [
{ category: [], sinks: ["sentry"], level: "debug" },
],
});
~~~~
Changelog
---------
Initial release. Released on November 26, 2024.