@mimik/sumologic-winston-logger 2.1.12 → 2.1.13
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/configuration/config.js +5 -4
- package/lib/common.js +5 -2
- package/lib/formatLib.js +1 -1
- package/lib/stackLib.js +2 -2
- package/package.json +1 -1
- package/test/logger.spec.js +12 -0
package/configuration/config.js
CHANGED
|
@@ -8,6 +8,7 @@ import {
|
|
|
8
8
|
ENV_LOCAL,
|
|
9
9
|
NONE_MODE,
|
|
10
10
|
SUMOLOGIC,
|
|
11
|
+
isNil,
|
|
11
12
|
} from '../lib/common.js';
|
|
12
13
|
import process from 'node:process';
|
|
13
14
|
import { readFileSync } from 'node:fs';
|
|
@@ -152,8 +153,8 @@ if (configuration.mode.includes(AWS_KINESIS)) {
|
|
|
152
153
|
},
|
|
153
154
|
};
|
|
154
155
|
|
|
155
|
-
if (process.env.KINESIS_AWS_ACCESS_KEY_ID
|
|
156
|
-
if (process.env.KINESIS_AWS_SECRET_ACCESS_KEY
|
|
156
|
+
if (!isNil(process.env.KINESIS_AWS_ACCESS_KEY_ID)) configuration[AWS_KINESIS].accessKeyId = process.env.KINESIS_AWS_ACCESS_KEY_ID;
|
|
157
|
+
if (!isNil(process.env.KINESIS_AWS_SECRET_ACCESS_KEY)) configuration[AWS_KINESIS].secretAccessKey = process.env.KINESIS_AWS_SECRET_ACCESS_KEY;
|
|
157
158
|
}
|
|
158
159
|
if (configuration.mode.includes(AWS_S3)) {
|
|
159
160
|
configuration[AWS_S3] = {
|
|
@@ -164,8 +165,8 @@ if (configuration.mode.includes(AWS_S3)) {
|
|
|
164
165
|
maxEvents: parseInt(process.env.S3_AWS_MAX_EVENTS, DECIMAL) || 1000,
|
|
165
166
|
};
|
|
166
167
|
|
|
167
|
-
if (process.env.S3_AWS_ACCESS_KEY_ID
|
|
168
|
-
if (process.env.S3_AWS_SECRET_ACCESS_KEY
|
|
168
|
+
if (!isNil(process.env.S3_AWS_ACCESS_KEY_ID)) configuration[AWS_S3].accessKeyId = process.env.S3_AWS_ACCESS_KEY_ID;
|
|
169
|
+
if (!isNil(process.env.S3_AWS_SECRET_ACCESS_KEY)) configuration[AWS_S3].secretAccessKey = process.env.S3_AWS_SECRET_ACCESS_KEY;
|
|
169
170
|
}
|
|
170
171
|
const { filter } = configuration;
|
|
171
172
|
let filterConfig = [];
|
package/lib/common.js
CHANGED
|
@@ -53,6 +53,8 @@ const safeStringify = (obj) => {
|
|
|
53
53
|
});
|
|
54
54
|
};
|
|
55
55
|
|
|
56
|
+
const isNil = value => value === null || value === undefined;
|
|
57
|
+
|
|
56
58
|
export {
|
|
57
59
|
ALL_MODE,
|
|
58
60
|
ALL_MODES,
|
|
@@ -65,7 +67,6 @@ export {
|
|
|
65
67
|
ERROR,
|
|
66
68
|
FLUSH,
|
|
67
69
|
FLUSH_EXIT,
|
|
68
|
-
TEST_FLUSH_TIMEOUT,
|
|
69
70
|
INFO,
|
|
70
71
|
LEVEL,
|
|
71
72
|
LOG,
|
|
@@ -79,13 +80,15 @@ export {
|
|
|
79
80
|
OTHER,
|
|
80
81
|
PARTITION_KEY,
|
|
81
82
|
SPLAT,
|
|
82
|
-
TEST_START_TIMEOUT,
|
|
83
83
|
SUMOLOGIC,
|
|
84
84
|
SYSTEM_ERROR,
|
|
85
85
|
TEAPOT_ERROR,
|
|
86
|
+
TEST_FLUSH_TIMEOUT,
|
|
87
|
+
TEST_START_TIMEOUT,
|
|
86
88
|
UNAUTHORIZED_ERROR,
|
|
87
89
|
UNKNOWN_TYPE,
|
|
88
90
|
UNKNOWN_ID,
|
|
89
91
|
WARN,
|
|
90
92
|
safeStringify,
|
|
93
|
+
isNil,
|
|
91
94
|
};
|
package/lib/formatLib.js
CHANGED
package/lib/stackLib.js
CHANGED
|
@@ -45,8 +45,8 @@ const parseStack = (newError) => {
|
|
|
45
45
|
stackInfo.hash = createHash('sha256')
|
|
46
46
|
.update(stackInfo.stack)
|
|
47
47
|
.digest('hex');
|
|
48
|
-
// this is a hash of the
|
|
49
|
-
// security of this is not a concern since
|
|
48
|
+
// this is a hash of the stack trace for easier searching for the stack trace
|
|
49
|
+
// security of this is not a concern since the stack trace is also sent unencrypted
|
|
50
50
|
return stackInfo;
|
|
51
51
|
};
|
|
52
52
|
|
package/package.json
CHANGED
package/test/logger.spec.js
CHANGED
|
@@ -183,6 +183,18 @@ describe('Sumologic transport', function SumoTests() {
|
|
|
183
183
|
});
|
|
184
184
|
sumo.log({ level: 'info', message: 'test globalThis' });
|
|
185
185
|
});
|
|
186
|
+
|
|
187
|
+
it('falls back to unknownServerId when globalThis.serverId is not set', (done) => {
|
|
188
|
+
globalThis.serverType = 'mSumoRemote';
|
|
189
|
+
sumo.code = '401';
|
|
190
|
+
sumo.once('warn', (resp) => {
|
|
191
|
+
resp.data.should.have.property('serverType', 'mSumoRemote');
|
|
192
|
+
resp.data.should.have.property('serverId', 'unknownServerId@clients');
|
|
193
|
+
delete globalThis.serverType;
|
|
194
|
+
done();
|
|
195
|
+
});
|
|
196
|
+
sumo.log({ level: 'info', message: 'test serverId fallback' });
|
|
197
|
+
});
|
|
186
198
|
});
|
|
187
199
|
|
|
188
200
|
describe('S3 transport', function S3Tests() {
|