@loggerjs/sentry 0.0.2 → 0.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +44 -6
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -1,22 +1,60 @@
|
|
|
1
1
|
# @loggerjs/sentry
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
> Forward LoggerJS logs to Sentry as structured logs, breadcrumbs, and captured exceptions/messages.
|
|
4
|
+
|
|
5
|
+
[](https://www.npmjs.com/package/@loggerjs/sentry)
|
|
6
|
+
[](../../LICENSE)
|
|
7
|
+
|
|
8
|
+
A Sentry adapter transport for [LoggerJS](../../README.md). It uses the Sentry SDK your app already initialized — no second SDK is bundled — and can emit structured logs, attach breadcrumbs, and capture errors and messages as Sentry events.
|
|
9
|
+
|
|
10
|
+
## Install
|
|
11
|
+
|
|
12
|
+
```bash
|
|
13
|
+
npm install @loggerjs/sentry
|
|
14
|
+
```
|
|
15
|
+
|
|
16
|
+
`@sentry/core` (`>=8 <11`) is a **peer dependency**. Pass the Sentry object (browser or Node SDK) your application uses.
|
|
17
|
+
|
|
18
|
+
## Usage
|
|
4
19
|
|
|
5
20
|
```ts
|
|
6
21
|
import { createLogger } from "@loggerjs/core";
|
|
7
22
|
import { sentryTransport } from "@loggerjs/sentry";
|
|
23
|
+
import * as Sentry from "@sentry/browser";
|
|
8
24
|
|
|
9
25
|
const logger = createLogger({
|
|
10
|
-
|
|
26
|
+
category: ["web"],
|
|
11
27
|
transports: [
|
|
12
28
|
sentryTransport({
|
|
13
29
|
sentry: Sentry,
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
captureErrors: true,
|
|
30
|
+
structuredLogs: true, // send structured logs
|
|
31
|
+
breadcrumbs: true, // add each log as a breadcrumb
|
|
32
|
+
captureErrors: true, // capture events carrying an Error as exceptions
|
|
17
33
|
}),
|
|
18
34
|
],
|
|
19
35
|
});
|
|
20
36
|
```
|
|
21
37
|
|
|
22
|
-
|
|
38
|
+
## Options
|
|
39
|
+
|
|
40
|
+
| Option | Description |
|
|
41
|
+
| --- | --- |
|
|
42
|
+
| `sentry` | **Required.** The initialized Sentry SDK object. |
|
|
43
|
+
| `structuredLogs` | Send events as Sentry structured logs. |
|
|
44
|
+
| `breadcrumbs` | Add each log as a breadcrumb for later events. |
|
|
45
|
+
| `captureErrors` | Capture events that carry an `Error` as Sentry exceptions. |
|
|
46
|
+
| `captureMessages` | Capture non-error events as Sentry messages. |
|
|
47
|
+
| `eventLevel` | Minimum level promoted to a captured Sentry event. |
|
|
48
|
+
| `minLevel` | Minimum level this transport accepts. |
|
|
49
|
+
|
|
50
|
+
## Subpath exports
|
|
51
|
+
|
|
52
|
+
`@loggerjs/sentry/transport`
|
|
53
|
+
|
|
54
|
+
## Documentation
|
|
55
|
+
|
|
56
|
+
- [Transports](../../docs/TRANSPORTS.md) · [Operations](../../docs/OPERATIONS.md) · [LoggerJS root README](../../README.md)
|
|
57
|
+
|
|
58
|
+
## License
|
|
59
|
+
|
|
60
|
+
[MIT](../../LICENSE) © JS Kits
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@loggerjs/sentry",
|
|
3
|
-
"version": "0.0
|
|
3
|
+
"version": "0.3.0",
|
|
4
4
|
"description": "Sentry adapter transport for loggerjs.",
|
|
5
5
|
"homepage": "https://github.com/jskits/loggerjs/tree/main/packages/sentry#readme",
|
|
6
6
|
"bugs": {
|
|
@@ -39,7 +39,7 @@
|
|
|
39
39
|
"provenance": true
|
|
40
40
|
},
|
|
41
41
|
"dependencies": {
|
|
42
|
-
"@loggerjs/core": "0.0
|
|
42
|
+
"@loggerjs/core": "0.3.0"
|
|
43
43
|
},
|
|
44
44
|
"peerDependencies": {
|
|
45
45
|
"@sentry/core": ">=8 <11"
|