unnbound-logger-sdk 3.0.16 → 3.0.18
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/dist/trace.d.ts +5 -0
- package/dist/trace.js +9 -2
- package/package.json +1 -1
package/dist/trace.d.ts
CHANGED
|
@@ -3,6 +3,11 @@
|
|
|
3
3
|
* @returns A trace ID
|
|
4
4
|
*/
|
|
5
5
|
export declare const getTraceId: () => string;
|
|
6
|
+
/**
|
|
7
|
+
* Generates a message ID
|
|
8
|
+
* @returns A message ID
|
|
9
|
+
*/
|
|
10
|
+
export declare const getMessageId: () => string;
|
|
6
11
|
/**
|
|
7
12
|
* Runs a callback with a trace ID
|
|
8
13
|
* @param callback - The callback to run
|
package/dist/trace.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.withTrace = exports.getTraceId = void 0;
|
|
3
|
+
exports.withTrace = exports.getMessageId = exports.getTraceId = void 0;
|
|
4
4
|
const uuid_1 = require("uuid");
|
|
5
5
|
const storage_1 = require("./storage");
|
|
6
6
|
/**
|
|
@@ -9,6 +9,12 @@ const storage_1 = require("./storage");
|
|
|
9
9
|
*/
|
|
10
10
|
const getTraceId = () => (0, uuid_1.v4)();
|
|
11
11
|
exports.getTraceId = getTraceId;
|
|
12
|
+
/**
|
|
13
|
+
* Generates a message ID
|
|
14
|
+
* @returns A message ID
|
|
15
|
+
*/
|
|
16
|
+
const getMessageId = () => (0, uuid_1.v4)();
|
|
17
|
+
exports.getMessageId = getMessageId;
|
|
12
18
|
/**
|
|
13
19
|
* Runs a callback with a trace ID
|
|
14
20
|
* @param callback - The callback to run
|
|
@@ -18,6 +24,7 @@ exports.getTraceId = getTraceId;
|
|
|
18
24
|
const withTrace = (callback, extra) => {
|
|
19
25
|
const previous = storage_1.storage.getStore();
|
|
20
26
|
const traceId = extra?.traceId ?? previous?.traceId ?? (0, exports.getTraceId)();
|
|
21
|
-
|
|
27
|
+
const messageId = extra?.messageId ?? previous?.messageId ?? (0, exports.getMessageId)();
|
|
28
|
+
return storage_1.storage.run({ ...previous, ...extra, traceId, messageId }, callback);
|
|
22
29
|
};
|
|
23
30
|
exports.withTrace = withTrace;
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "unnbound-logger-sdk",
|
|
3
3
|
"description": "A structured logging library with TypeScript support using Pino. Provides consistent, well-typed logging with automatic logId, workflowId, traceId, and deploymentId tracking across operational contexts.",
|
|
4
|
-
"version": "3.0.
|
|
4
|
+
"version": "3.0.18",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"types": "dist/index.d.ts",
|
|
7
7
|
"scripts": {
|