@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.
Files changed (39) hide show
  1. package/README.md +20 -2
  2. package/dist/index.cjs +848 -0
  3. package/dist/index.d.cts +138 -0
  4. package/dist/index.d.mts +138 -0
  5. package/dist/index.mjs +763 -0
  6. package/package.json +5 -2
  7. package/.oxlintrc.json +0 -7
  8. package/.release-it.json +0 -13
  9. package/CHANGELOG.md +0 -22
  10. package/src/Flare.ts +0 -224
  11. package/src/context/body.ts +0 -185
  12. package/src/context/collectNode.ts +0 -116
  13. package/src/context/headers.ts +0 -90
  14. package/src/context/process.ts +0 -25
  15. package/src/index.ts +0 -27
  16. package/src/process/fatal.ts +0 -54
  17. package/src/process/handlers.ts +0 -109
  18. package/src/scope/AsyncLocalStorageScopeProvider.ts +0 -86
  19. package/src/scope/NodeScope.ts +0 -8
  20. package/src/stacktrace/DiskFileReader.ts +0 -57
  21. package/src/types.ts +0 -37
  22. package/tests/asyncScopeProvider.test.ts +0 -43
  23. package/tests/body.test.ts +0 -129
  24. package/tests/diskFileReader.test.ts +0 -36
  25. package/tests/fatalHandlers.test.ts +0 -140
  26. package/tests/flush.test.ts +0 -11
  27. package/tests/headers.test.ts +0 -86
  28. package/tests/integration.test.ts +0 -63
  29. package/tests/lifecycle.test.ts +0 -71
  30. package/tests/nodeContextCollector.test.ts +0 -106
  31. package/tests/nodeExports.test.ts +0 -11
  32. package/tests/nodeScope.test.ts +0 -19
  33. package/tests/processAttributes.test.ts +0 -15
  34. package/tests/processHandlers.test.ts +0 -47
  35. package/tests/regexFlagSanitization.test.ts +0 -88
  36. package/tests/scopeIsolation.test.ts +0 -47
  37. package/tests/setFrameworkScope.test.ts +0 -86
  38. package/tsconfig.json +0 -9
  39. 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, and explicit `flare.report(err)` calls in
5
- your Node servers. Per-request context isolation via AsyncLocalStorage.
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