@duckbug/js 1.0.0 → 1.1.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 (2) hide show
  1. package/README.md +17 -0
  2. package/package.json +1 -1
package/README.md CHANGED
@@ -63,6 +63,23 @@ duck.warn('Slow query', { ms: 1200 });
63
63
 
64
64
  Before process exit, await `duck.flush()` so queued HTTP work finishes (for example at the end of an `async main()`).
65
65
 
66
+ ### Reserved `_duck` on log payloads
67
+
68
+ The second argument to `log` / `debug` / `warn` / `error` / `fatal` may be a plain object with a reserved **`_duck`** field for technical metadata. **`_duck` is not sent inside `context`** on the wire.
69
+
70
+ - **`_duck.dTags`** — sets top-level `dTags` on the ingest event (same as in a raw JSON body).
71
+ - **`_duck.scope`** — one-shot `Partial<IngestSharedMetadata>` merged into **this** log only (after global `setScope`, before fixed fields). Use e.g. `platform: "ios"` to override the default `"node"`. Optional **`_duck.scope.context`** is used as the event `context` only when there are no other keys besides `_duck`.
72
+
73
+ Any other keys on the object become **`context`**, which matches typical ingest JSON (`dTags` at the root, domain fields under `context`).
74
+
75
+ ```typescript
76
+ duck.warn("DUCKBUG_DTAGS_SMOKE_TEST", {
77
+ source: "initDuckBugDeviceContext",
78
+ platform: "ios",
79
+ _duck: { dTags: ["smoke-test", "dtags"] },
80
+ });
81
+ ```
82
+
66
83
  ## Full usage example
67
84
 
68
85
  End-to-end pattern for a Node/Bun service: DSN from env, scope (release, user, fingerprint), privacy pipeline, `beforeSend`, batched transport with retries, transport errors, console forwarding, global error handlers, structured logs, manual errors, and clean shutdown.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@duckbug/js",
3
- "version": "1.0.0",
3
+ "version": "1.1.0",
4
4
  "type": "module",
5
5
  "main": "./dist/cjs/index.cjs",
6
6
  "module": "./dist/esm/index.js",