@unito/integration-sdk 1.0.23 → 1.0.24
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/src/index.cjs
CHANGED
|
@@ -33,35 +33,35 @@ describe('Logger', () => {
|
|
|
33
33
|
logger.log('test');
|
|
34
34
|
assert.strictEqual(logSpy.mock.calls.length, 1);
|
|
35
35
|
assert.deepEqual(logSpy.mock.calls[0]?.arguments, [
|
|
36
|
-
JSON.stringify({ correlation_id: '123456789', message: 'test' }),
|
|
36
|
+
JSON.stringify({ correlation_id: '123456789', message: 'test', status: 'log' }),
|
|
37
37
|
]);
|
|
38
38
|
const errorSpy = testContext.mock.method(global.console, 'error', () => { });
|
|
39
39
|
assert.strictEqual(errorSpy.mock.calls.length, 0);
|
|
40
40
|
logger.error('test');
|
|
41
41
|
assert.strictEqual(errorSpy.mock.calls.length, 1);
|
|
42
42
|
assert.deepEqual(errorSpy.mock.calls[0]?.arguments, [
|
|
43
|
-
JSON.stringify({ correlation_id: '123456789', message: 'test' }),
|
|
43
|
+
JSON.stringify({ correlation_id: '123456789', message: 'test', status: 'error' }),
|
|
44
44
|
]);
|
|
45
45
|
const warnSpy = testContext.mock.method(global.console, 'warn', () => { });
|
|
46
46
|
assert.strictEqual(warnSpy.mock.calls.length, 0);
|
|
47
47
|
logger.warn('test');
|
|
48
48
|
assert.strictEqual(warnSpy.mock.calls.length, 1);
|
|
49
49
|
assert.deepEqual(warnSpy.mock.calls[0]?.arguments, [
|
|
50
|
-
JSON.stringify({ correlation_id: '123456789', message: 'test' }),
|
|
50
|
+
JSON.stringify({ correlation_id: '123456789', message: 'test', status: 'warn' }),
|
|
51
51
|
]);
|
|
52
52
|
const infoSpy = testContext.mock.method(global.console, 'info', () => { });
|
|
53
53
|
assert.strictEqual(infoSpy.mock.calls.length, 0);
|
|
54
54
|
logger.info('test');
|
|
55
55
|
assert.strictEqual(infoSpy.mock.calls.length, 1);
|
|
56
56
|
assert.deepEqual(infoSpy.mock.calls[0]?.arguments, [
|
|
57
|
-
JSON.stringify({ correlation_id: '123456789', message: 'test' }),
|
|
57
|
+
JSON.stringify({ correlation_id: '123456789', message: 'test', status: 'info' }),
|
|
58
58
|
]);
|
|
59
59
|
const debugSpy = testContext.mock.method(global.console, 'debug', () => { });
|
|
60
60
|
assert.strictEqual(debugSpy.mock.calls.length, 0);
|
|
61
61
|
logger.debug('test');
|
|
62
62
|
assert.strictEqual(debugSpy.mock.calls.length, 1);
|
|
63
63
|
assert.deepEqual(debugSpy.mock.calls[0]?.arguments, [
|
|
64
|
-
JSON.stringify({ correlation_id: '123456789', message: 'test' }),
|
|
64
|
+
JSON.stringify({ correlation_id: '123456789', message: 'test', status: 'debug' }),
|
|
65
65
|
]);
|
|
66
66
|
});
|
|
67
67
|
it('merges message payload with metadata', testContext => {
|
|
@@ -77,6 +77,7 @@ describe('Logger', () => {
|
|
|
77
77
|
http: { method: 'GET' },
|
|
78
78
|
error: { code: '200', message: 'Page Not Found' },
|
|
79
79
|
message: 'test',
|
|
80
|
+
status: 'log',
|
|
80
81
|
}),
|
|
81
82
|
]);
|
|
82
83
|
});
|
|
@@ -92,6 +93,7 @@ describe('Logger', () => {
|
|
|
92
93
|
correlation_id: '123456789',
|
|
93
94
|
http: { status_code: 200 },
|
|
94
95
|
message: 'test',
|
|
96
|
+
status: 'log',
|
|
95
97
|
}),
|
|
96
98
|
]);
|
|
97
99
|
});
|
|
@@ -108,6 +110,7 @@ describe('Logger', () => {
|
|
|
108
110
|
http: { method: 'GET', status_code: 200 },
|
|
109
111
|
error_context: { error_code: 200, error_message: 'Page Not Found' },
|
|
110
112
|
message: 'test',
|
|
113
|
+
status: 'log',
|
|
111
114
|
}),
|
|
112
115
|
]);
|
|
113
116
|
});
|
package/package.json
CHANGED
package/src/resources/logger.ts
CHANGED
|
@@ -42,7 +42,7 @@ describe('Logger', () => {
|
|
|
42
42
|
logger.log('test');
|
|
43
43
|
assert.strictEqual(logSpy.mock.calls.length, 1);
|
|
44
44
|
assert.deepEqual(logSpy.mock.calls[0]?.arguments, [
|
|
45
|
-
JSON.stringify({ correlation_id: '123456789', message: 'test' }),
|
|
45
|
+
JSON.stringify({ correlation_id: '123456789', message: 'test', status: 'log' }),
|
|
46
46
|
]);
|
|
47
47
|
|
|
48
48
|
const errorSpy = testContext.mock.method(global.console, 'error', () => {});
|
|
@@ -50,7 +50,7 @@ describe('Logger', () => {
|
|
|
50
50
|
logger.error('test');
|
|
51
51
|
assert.strictEqual(errorSpy.mock.calls.length, 1);
|
|
52
52
|
assert.deepEqual(errorSpy.mock.calls[0]?.arguments, [
|
|
53
|
-
JSON.stringify({ correlation_id: '123456789', message: 'test' }),
|
|
53
|
+
JSON.stringify({ correlation_id: '123456789', message: 'test', status: 'error' }),
|
|
54
54
|
]);
|
|
55
55
|
|
|
56
56
|
const warnSpy = testContext.mock.method(global.console, 'warn', () => {});
|
|
@@ -58,7 +58,7 @@ describe('Logger', () => {
|
|
|
58
58
|
logger.warn('test');
|
|
59
59
|
assert.strictEqual(warnSpy.mock.calls.length, 1);
|
|
60
60
|
assert.deepEqual(warnSpy.mock.calls[0]?.arguments, [
|
|
61
|
-
JSON.stringify({ correlation_id: '123456789', message: 'test' }),
|
|
61
|
+
JSON.stringify({ correlation_id: '123456789', message: 'test', status: 'warn' }),
|
|
62
62
|
]);
|
|
63
63
|
|
|
64
64
|
const infoSpy = testContext.mock.method(global.console, 'info', () => {});
|
|
@@ -66,7 +66,7 @@ describe('Logger', () => {
|
|
|
66
66
|
logger.info('test');
|
|
67
67
|
assert.strictEqual(infoSpy.mock.calls.length, 1);
|
|
68
68
|
assert.deepEqual(infoSpy.mock.calls[0]?.arguments, [
|
|
69
|
-
JSON.stringify({ correlation_id: '123456789', message: 'test' }),
|
|
69
|
+
JSON.stringify({ correlation_id: '123456789', message: 'test', status: 'info' }),
|
|
70
70
|
]);
|
|
71
71
|
|
|
72
72
|
const debugSpy = testContext.mock.method(global.console, 'debug', () => {});
|
|
@@ -74,7 +74,7 @@ describe('Logger', () => {
|
|
|
74
74
|
logger.debug('test');
|
|
75
75
|
assert.strictEqual(debugSpy.mock.calls.length, 1);
|
|
76
76
|
assert.deepEqual(debugSpy.mock.calls[0]?.arguments, [
|
|
77
|
-
JSON.stringify({ correlation_id: '123456789', message: 'test' }),
|
|
77
|
+
JSON.stringify({ correlation_id: '123456789', message: 'test', status: 'debug' }),
|
|
78
78
|
]);
|
|
79
79
|
});
|
|
80
80
|
|
|
@@ -92,6 +92,7 @@ describe('Logger', () => {
|
|
|
92
92
|
http: { method: 'GET' },
|
|
93
93
|
error: { code: '200', message: 'Page Not Found' },
|
|
94
94
|
message: 'test',
|
|
95
|
+
status: 'log',
|
|
95
96
|
}),
|
|
96
97
|
]);
|
|
97
98
|
});
|
|
@@ -109,6 +110,7 @@ describe('Logger', () => {
|
|
|
109
110
|
correlation_id: '123456789',
|
|
110
111
|
http: { status_code: 200 },
|
|
111
112
|
message: 'test',
|
|
113
|
+
status: 'log',
|
|
112
114
|
}),
|
|
113
115
|
]);
|
|
114
116
|
});
|
|
@@ -127,6 +129,7 @@ describe('Logger', () => {
|
|
|
127
129
|
http: { method: 'GET', status_code: 200 },
|
|
128
130
|
error_context: { error_code: 200, error_message: 'Page Not Found' },
|
|
129
131
|
message: 'test',
|
|
132
|
+
status: 'log',
|
|
130
133
|
}),
|
|
131
134
|
]);
|
|
132
135
|
});
|