unnbound-logger-sdk 3.0.11 → 3.0.12
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 +1 -1
- package/dist/logger.js +14 -4
- package/dist/types.d.ts +13 -0
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
* A structured logging library built on Pino with TypeScript support.
|
|
5
5
|
* Provides consistent, well-typed logging across different operational contexts.
|
|
6
6
|
*/
|
|
7
|
-
export type { LogLevel, LogType, HttpMethod, Log, HttpPayload, SftpPayload } from './types';
|
|
7
|
+
export type { LogLevel, LogType, HttpMethod, Log, HttpPayload, SftpPayload, EdiPayload, EdiOperation, EdiFormat, EdiX12Payload, EdiX12Operation, } from './types';
|
|
8
8
|
export type { UnnboundLogger } from './logger';
|
|
9
9
|
export { logger } from './logger';
|
|
10
10
|
export { withTrace, getTraceId } from './trace';
|
package/dist/logger.js
CHANGED
|
@@ -7,8 +7,10 @@ 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 levels = new Set(['debug', 'info', 'warn', 'error']);
|
|
11
|
+
const hidden = (data) => '_hide' in data && data._hide;
|
|
10
12
|
exports.logger = (0, pino_1.default)({
|
|
11
|
-
level: process.env.LOG_LEVEL ?? '
|
|
13
|
+
level: process.env.LOG_LEVEL ?? 'debug',
|
|
12
14
|
base: {
|
|
13
15
|
environment: process.env.ENVIRONMENT,
|
|
14
16
|
workflowId: process.env.UNNBOUND_WORKFLOW_ID,
|
|
@@ -31,9 +33,17 @@ exports.logger = (0, pino_1.default)({
|
|
|
31
33
|
hooks: {
|
|
32
34
|
logMethod(args, method) {
|
|
33
35
|
const firstArg = args[0];
|
|
34
|
-
if (!!firstArg && typeof firstArg === 'object'
|
|
35
|
-
|
|
36
|
-
|
|
36
|
+
if (!!firstArg && typeof firstArg === 'object') {
|
|
37
|
+
if (hidden(firstArg))
|
|
38
|
+
return;
|
|
39
|
+
// Allow dynamic log level
|
|
40
|
+
if ('level' in firstArg &&
|
|
41
|
+
typeof firstArg.level === 'string' &&
|
|
42
|
+
levels.has(firstArg.level)) {
|
|
43
|
+
method = this[firstArg.level];
|
|
44
|
+
firstArg.level = undefined;
|
|
45
|
+
}
|
|
46
|
+
}
|
|
37
47
|
method.apply(this, args);
|
|
38
48
|
},
|
|
39
49
|
},
|
package/dist/types.d.ts
CHANGED
|
@@ -25,6 +25,7 @@ export interface Log<T extends LogType = 'general'> {
|
|
|
25
25
|
workflowId?: string;
|
|
26
26
|
http: T extends 'http' ? HttpPayload : never;
|
|
27
27
|
sftp: T extends 'sftp' ? SftpPayload : never;
|
|
28
|
+
edi: T extends 'edi' ? EdiPayload : never;
|
|
28
29
|
duration?: number;
|
|
29
30
|
err?: unknown;
|
|
30
31
|
}
|
|
@@ -53,6 +54,18 @@ export interface SftpPayload {
|
|
|
53
54
|
content?: string;
|
|
54
55
|
exists?: string | false;
|
|
55
56
|
}
|
|
57
|
+
export type EdiX12Operation = 'fromX12' | 'toX12' | 'validateX12' | 'acknowledgeX12';
|
|
58
|
+
export type EdiOperation = EdiX12Operation;
|
|
59
|
+
export type EdiFormat = 'x12';
|
|
60
|
+
export interface EdiX12Payload {
|
|
61
|
+
input: unknown;
|
|
62
|
+
output: unknown;
|
|
63
|
+
}
|
|
64
|
+
export interface EdiPayload {
|
|
65
|
+
operation: EdiOperation;
|
|
66
|
+
type: EdiFormat;
|
|
67
|
+
x12?: EdiX12Payload;
|
|
68
|
+
}
|
|
56
69
|
export interface HttpOptions<G extends Function> {
|
|
57
70
|
ignoreTraceRoutes?: string[];
|
|
58
71
|
traceHeaderKey?: string;
|
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.12",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"types": "dist/index.d.ts",
|
|
7
7
|
"keywords": [
|