@flareapp/node 0.1.0 → 0.2.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 +20 -2
- package/dist/index.cjs +848 -0
- package/dist/index.d.cts +138 -0
- package/dist/index.d.mts +138 -0
- package/dist/index.mjs +763 -0
- package/package.json +5 -2
- package/.oxlintrc.json +0 -7
- package/.release-it.json +0 -13
- package/CHANGELOG.md +0 -22
- package/src/Flare.ts +0 -224
- package/src/context/body.ts +0 -185
- package/src/context/collectNode.ts +0 -116
- package/src/context/headers.ts +0 -90
- package/src/context/process.ts +0 -25
- package/src/index.ts +0 -27
- package/src/process/fatal.ts +0 -54
- package/src/process/handlers.ts +0 -109
- package/src/scope/AsyncLocalStorageScopeProvider.ts +0 -86
- package/src/scope/NodeScope.ts +0 -8
- package/src/stacktrace/DiskFileReader.ts +0 -57
- package/src/types.ts +0 -37
- package/tests/asyncScopeProvider.test.ts +0 -43
- package/tests/body.test.ts +0 -129
- package/tests/diskFileReader.test.ts +0 -36
- package/tests/fatalHandlers.test.ts +0 -140
- package/tests/flush.test.ts +0 -11
- package/tests/headers.test.ts +0 -86
- package/tests/integration.test.ts +0 -63
- package/tests/lifecycle.test.ts +0 -71
- package/tests/nodeContextCollector.test.ts +0 -106
- package/tests/nodeExports.test.ts +0 -11
- package/tests/nodeScope.test.ts +0 -19
- package/tests/processAttributes.test.ts +0 -15
- package/tests/processHandlers.test.ts +0 -47
- package/tests/regexFlagSanitization.test.ts +0 -88
- package/tests/scopeIsolation.test.ts +0 -47
- package/tests/setFrameworkScope.test.ts +0 -86
- package/tsconfig.json +0 -9
- package/vitest.config.ts +0 -18
package/README.md
CHANGED
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
# @flareapp/node
|
|
2
2
|
|
|
3
3
|
Node.js SDK for [flareapp.io](https://flareapp.io). Capture uncaught
|
|
4
|
-
exceptions, unhandled rejections,
|
|
5
|
-
your Node servers. Per-request context isolation via
|
|
4
|
+
exceptions, unhandled rejections, explicit `flare.report(err)` calls, and
|
|
5
|
+
structured logs in your Node servers. Per-request context isolation via
|
|
6
|
+
AsyncLocalStorage.
|
|
6
7
|
|
|
7
8
|
> **Status: unstable (0.x).** This package is pre-1.0 and its API may change
|
|
8
9
|
> between minor releases. Pin an exact version in production
|
|
@@ -28,6 +29,23 @@ flare.light('your-flare-api-key');
|
|
|
28
29
|
That's it. Crashes and unhandled rejections are reported automatically (the
|
|
29
30
|
default behavior is to report, flush, and exit with code 1).
|
|
30
31
|
|
|
32
|
+
## Logging
|
|
33
|
+
|
|
34
|
+
Beyond errors, the SDK can send structured logs. Logs are opt-in: enable them
|
|
35
|
+
with `enableLogs`, then call any of the eight syslog levels (`debug`, `info`,
|
|
36
|
+
`notice`, `warning`, `error`, `critical`, `alert`, `emergency`).
|
|
37
|
+
|
|
38
|
+
```ts
|
|
39
|
+
flare.configure({ enableLogs: true });
|
|
40
|
+
|
|
41
|
+
flare.logger.info('Order processed', { orderId: order.id, total: order.total });
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
Logs are buffered and batched, and flushed on `beforeExit`. A log recorded
|
|
45
|
+
inside a `runWithContext` scope carries that request's context. `beforeExit`
|
|
46
|
+
does not fire on `SIGTERM` or `process.exit()`, so call `flare.flush()` during
|
|
47
|
+
graceful shutdown to drain buffered logs.
|
|
48
|
+
|
|
31
49
|
## Per-request context
|
|
32
50
|
|
|
33
51
|
In an HTTP server, wrap each request handler with `runWithContext` so the
|