unnbound-logger-sdk 3.0.15 → 3.0.17

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/index.d.ts CHANGED
@@ -11,4 +11,3 @@ export { withTrace, getTraceId } from './trace';
11
11
  export { startSpan } from './span';
12
12
  export { traceAxios } from './axios';
13
13
  export { traceMiddleware } from './middleware';
14
- export { sanitizeLogContent } from './utils';
package/dist/index.js CHANGED
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.sanitizeLogContent = exports.traceMiddleware = exports.traceAxios = exports.startSpan = exports.getTraceId = exports.withTrace = exports.logger = void 0;
3
+ exports.traceMiddleware = exports.traceAxios = exports.startSpan = exports.getTraceId = exports.withTrace = exports.logger = void 0;
4
4
  var logger_1 = require("./logger");
5
5
  Object.defineProperty(exports, "logger", { enumerable: true, get: function () { return logger_1.logger; } });
6
6
  var trace_1 = require("./trace");
@@ -12,5 +12,3 @@ var axios_1 = require("./axios");
12
12
  Object.defineProperty(exports, "traceAxios", { enumerable: true, get: function () { return axios_1.traceAxios; } });
13
13
  var middleware_1 = require("./middleware");
14
14
  Object.defineProperty(exports, "traceMiddleware", { enumerable: true, get: function () { return middleware_1.traceMiddleware; } });
15
- var utils_1 = require("./utils");
16
- Object.defineProperty(exports, "sanitizeLogContent", { enumerable: true, get: function () { return utils_1.sanitizeLogContent; } });
package/dist/logger.js CHANGED
@@ -7,7 +7,6 @@ exports.logger = void 0;
7
7
  const pino_1 = __importDefault(require("pino"));
8
8
  const uuid_1 = require("uuid");
9
9
  const storage_1 = require("./storage");
10
- const utils_1 = require("./utils");
11
10
  const levels = new Set(['debug', 'info', 'warn', 'error']);
12
11
  const hidden = (data) => '_hide' in data && data._hide;
13
12
  exports.logger = (0, pino_1.default)({
@@ -45,9 +44,7 @@ exports.logger = (0, pino_1.default)({
45
44
  firstArg.level = undefined;
46
45
  }
47
46
  }
48
- // Sanitize all arguments to prevent CloudWatch log splitting
49
- const sanitizedArgs = args.map((arg) => (0, utils_1.sanitizeLogContent)(arg));
50
- method.apply(this, sanitizedArgs);
47
+ method.apply(this, args);
51
48
  },
52
49
  },
53
50
  redact: {
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
- return storage_1.storage.run({ ...previous, ...extra, traceId }, callback);
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/dist/utils.d.ts CHANGED
@@ -11,13 +11,6 @@ export declare const shouldIgnorePath: (path: string, patterns: string[]) => boo
11
11
  * @returns Parsed JSON object or the original data.
12
12
  */
13
13
  export declare function safeJsonParse(data: any): any;
14
- /**
15
- * Sanitizes log content by replacing newlines with carriage returns to prevent
16
- * CloudWatch from splitting logs into multiple entries.
17
- * @param obj The object to sanitize
18
- * @returns Sanitized object with newlines replaced
19
- */
20
- export declare function sanitizeLogContent(obj: any): any;
21
14
  /**
22
15
  * Normalizes IP addresses by removing IPv6 mapping prefix for IPv4 addresses.
23
16
  * @param ip The IP address to normalize.
package/dist/utils.js CHANGED
@@ -2,7 +2,6 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.shouldIgnorePath = void 0;
4
4
  exports.safeJsonParse = safeJsonParse;
5
- exports.sanitizeLogContent = sanitizeLogContent;
6
5
  exports.normalizeIp = normalizeIp;
7
6
  /**
8
7
  * Checks if a path matches any of the ignore patterns
@@ -38,33 +37,6 @@ function safeJsonParse(data) {
38
37
  }
39
38
  return data;
40
39
  }
41
- /**
42
- * Sanitizes log content by replacing newlines with carriage returns to prevent
43
- * CloudWatch from splitting logs into multiple entries.
44
- * @param obj The object to sanitize
45
- * @returns Sanitized object with newlines replaced
46
- */
47
- function sanitizeLogContent(obj) {
48
- if (obj === null || obj === undefined) {
49
- return obj;
50
- }
51
- if (typeof obj === 'string') {
52
- // Replace \n and \r\n with \r to prevent CloudWatch log splitting
53
- return obj.replace(/\r?\n/g, '\r');
54
- }
55
- if (Array.isArray(obj)) {
56
- return obj.map(sanitizeLogContent);
57
- }
58
- if (typeof obj === 'object') {
59
- const sanitized = {};
60
- for (const [key, value] of Object.entries(obj)) {
61
- // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access
62
- sanitized[key] = sanitizeLogContent(value);
63
- }
64
- return sanitized;
65
- }
66
- return obj;
67
- }
68
40
  /**
69
41
  * Normalizes IP addresses by removing IPv6 mapping prefix for IPv4 addresses.
70
42
  * @param ip The IP address to normalize.
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.15",
4
+ "version": "3.0.17",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
7
7
  "scripts": {