unnbound-logger-sdk 3.0.4 → 3.0.6
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 +2 -2
- package/dist/types.d.ts +22 -26
- package/package.json +3 -2
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,
|
|
7
|
+
export type { LogLevel, LogType, HttpMethod, Log, HttpPayload, SftpPayload } 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
|
@@ -5,17 +5,17 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
6
|
exports.logger = void 0;
|
|
7
7
|
const pino_1 = __importDefault(require("pino"));
|
|
8
|
+
const uuid_1 = require("uuid");
|
|
8
9
|
const storage_1 = require("./storage");
|
|
9
10
|
exports.logger = (0, pino_1.default)({
|
|
10
11
|
level: process.env.LOG_LEVEL ?? 'info',
|
|
11
12
|
base: {
|
|
12
13
|
environment: process.env.ENVIRONMENT,
|
|
13
14
|
workflowId: process.env.UNNBOUND_WORKFLOW_ID,
|
|
14
|
-
workflowUrl: process.env.UNNBOUND_WORKFLOW_URL,
|
|
15
15
|
serviceId: process.env.UNNBOUND_SERVICE_ID,
|
|
16
16
|
deploymentId: process.env.UNNBOUND_DEPLOYMENT_ID,
|
|
17
17
|
},
|
|
18
|
-
mixin: () => ({ ...storage_1.storage.getStore() }),
|
|
18
|
+
mixin: () => ({ ...storage_1.storage.getStore(), logId: (0, uuid_1.v4)() }),
|
|
19
19
|
serializers: {
|
|
20
20
|
req: pino_1.default.stdSerializers.req,
|
|
21
21
|
res: pino_1.default.stdSerializers.res,
|
package/dist/types.d.ts
CHANGED
|
@@ -8,39 +8,38 @@ export type LogLevel = 'info' | 'debug' | 'error' | 'warn';
|
|
|
8
8
|
/**
|
|
9
9
|
* Available log types
|
|
10
10
|
*/
|
|
11
|
-
export type LogType = 'general' | 'http' | 'sftp'
|
|
11
|
+
export type LogType = 'general' | 'http' | 'sftp';
|
|
12
12
|
/**
|
|
13
13
|
* HTTP methods supported for HTTP logging
|
|
14
14
|
*/
|
|
15
15
|
export type HttpMethod = 'GET' | 'POST' | 'PUT' | 'DELETE' | 'PATCH' | 'OPTIONS' | 'HEAD';
|
|
16
16
|
export interface Log<T extends LogType = 'general'> {
|
|
17
|
+
logId: string;
|
|
17
18
|
level: LogLevel;
|
|
18
19
|
message: string;
|
|
19
|
-
traceId: string;
|
|
20
|
-
spanId?: string;
|
|
21
20
|
type: T;
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
21
|
+
traceId?: string;
|
|
22
|
+
spanId?: string;
|
|
23
|
+
serviceId?: string;
|
|
24
|
+
deploymentId?: string;
|
|
25
|
+
workflowId?: string;
|
|
26
|
+
http: T extends 'http' ? HttpPayload : never;
|
|
27
|
+
sftp: T extends 'sftp' ? SftpPayload : never;
|
|
28
28
|
duration?: number;
|
|
29
|
+
err?: unknown;
|
|
29
30
|
}
|
|
30
|
-
export interface
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
body?: unknown;
|
|
43
|
-
};
|
|
31
|
+
export interface HttpPayload {
|
|
32
|
+
url: string;
|
|
33
|
+
method: string;
|
|
34
|
+
ip?: string;
|
|
35
|
+
request: {
|
|
36
|
+
headers: Record<string, string>;
|
|
37
|
+
body?: unknown;
|
|
38
|
+
};
|
|
39
|
+
response?: {
|
|
40
|
+
headers: Record<string, string>;
|
|
41
|
+
status: number;
|
|
42
|
+
body?: unknown;
|
|
44
43
|
};
|
|
45
44
|
}
|
|
46
45
|
export type SftpOperation = 'connect' | 'upload' | 'download' | 'list' | 'delete' | 'rename' | 'stat' | 'exists' | 'realPath' | 'get' | 'put' | 'cwd' | 'mkdir' | 'rmdir' | 'chmod' | 'append' | 'uploadDir' | 'downloadDir' | 'close';
|
|
@@ -54,9 +53,6 @@ export interface SftpPayload {
|
|
|
54
53
|
content?: string;
|
|
55
54
|
exists?: string | false;
|
|
56
55
|
}
|
|
57
|
-
export interface SftpLog extends LogTransaction<'sftp'> {
|
|
58
|
-
sftp: SftpPayload;
|
|
59
|
-
}
|
|
60
56
|
export interface HttpOptions {
|
|
61
57
|
ignoreTraceRoutes?: string[];
|
|
62
58
|
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.6",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"types": "dist/index.d.ts",
|
|
7
7
|
"keywords": [
|
|
@@ -69,6 +69,7 @@
|
|
|
69
69
|
"format": "prettier --write .",
|
|
70
70
|
"format:check": "prettier --check .",
|
|
71
71
|
"start:example:node-app": "npx tsx --watch examples/node-app.ts",
|
|
72
|
-
"start:example:basic-usage": "npx tsx --watch examples/basic-usage.ts"
|
|
72
|
+
"start:example:basic-usage": "npx tsx --watch examples/basic-usage.ts",
|
|
73
|
+
"version:bump": "npm version patch"
|
|
73
74
|
}
|
|
74
75
|
}
|