@mimik/sumologic-winston-logger 2.1.13 → 2.1.14
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/.claude/settings.local.json +3 -1
- package/configuration/config.js +16 -18
- package/lib/common.js +6 -2
- package/package.json +5 -5
package/configuration/config.js
CHANGED
|
@@ -8,13 +8,11 @@ import {
|
|
|
8
8
|
ENV_LOCAL,
|
|
9
9
|
NONE_MODE,
|
|
10
10
|
SUMOLOGIC,
|
|
11
|
-
|
|
11
|
+
toInt,
|
|
12
12
|
} from '../lib/common.js';
|
|
13
13
|
import process from 'node:process';
|
|
14
14
|
import { readFileSync } from 'node:fs';
|
|
15
15
|
|
|
16
|
-
const DECIMAL = 10;
|
|
17
|
-
|
|
18
16
|
/**
|
|
19
17
|
*
|
|
20
18
|
* Logger configuration.
|
|
@@ -125,8 +123,8 @@ const configuration = {
|
|
|
125
123
|
filter: {
|
|
126
124
|
file: process.env.FILTER_FILE || null,
|
|
127
125
|
},
|
|
128
|
-
flushExitDelay:
|
|
129
|
-
flushExitTimeout:
|
|
126
|
+
flushExitDelay: toInt(process.env.FLUSH_EXIT_DELAY, 2000), // in millisecond
|
|
127
|
+
flushExitTimeout: toInt(process.env.FLUSH_EXIT_TIMEOUT, 5000), // in millisecond
|
|
130
128
|
noStack: process.env.NO_STACK || 'yes',
|
|
131
129
|
};
|
|
132
130
|
configuration.mode = checkMode(process.env.LOG_MODE) || [NONE_MODE];
|
|
@@ -143,30 +141,30 @@ if (configuration.mode.includes(AWS_KINESIS)) {
|
|
|
143
141
|
streamNameError: process.env.KINESIS_AWS_STREAM_NAME_ERROR,
|
|
144
142
|
streamNameOther: process.env.KINESIS_AWS_STREAM_NAME_OTHER,
|
|
145
143
|
region: process.env.KINESIS_AWS_REGION,
|
|
146
|
-
timeout:
|
|
147
|
-
maxSize:
|
|
148
|
-
maxEvents:
|
|
149
|
-
maxRetries:
|
|
144
|
+
timeout: toInt(process.env.KINESIS_AWS_TIMEOUT, 5), // in minute
|
|
145
|
+
maxSize: toInt(process.env.KINESIS_AWS_MAX_SIZE, 5), // in mByte
|
|
146
|
+
maxEvents: toInt(process.env.KINESIS_AWS_MAX_EVENTS, 1000),
|
|
147
|
+
maxRetries: toInt(process.env.KINESIS_AWS_MAX_RETRIES, 4),
|
|
150
148
|
httpOptions: {
|
|
151
|
-
socketTimeout:
|
|
152
|
-
connectionTimeout:
|
|
149
|
+
socketTimeout: toInt(process.env.KINESIS_AWS_HTTP_OPTIONS_SOCKET_TIMEOUT, 5000), // in millisecond
|
|
150
|
+
connectionTimeout: toInt(process.env.KINESIS_AWS_HTTP_OPTIONS_CONNECTION_TIMEOUT, 5000), // in millisecond
|
|
153
151
|
},
|
|
154
152
|
};
|
|
155
153
|
|
|
156
|
-
if (
|
|
157
|
-
if (
|
|
154
|
+
if (process.env.KINESIS_AWS_ACCESS_KEY_ID !== undefined) configuration[AWS_KINESIS].accessKeyId = process.env.KINESIS_AWS_ACCESS_KEY_ID;
|
|
155
|
+
if (process.env.KINESIS_AWS_SECRET_ACCESS_KEY !== undefined) configuration[AWS_KINESIS].secretAccessKey = process.env.KINESIS_AWS_SECRET_ACCESS_KEY;
|
|
158
156
|
}
|
|
159
157
|
if (configuration.mode.includes(AWS_S3)) {
|
|
160
158
|
configuration[AWS_S3] = {
|
|
161
159
|
bucketname: process.env.S3_AWS_BUCKET_NAME,
|
|
162
160
|
region: process.env.S3_AWS_REGION,
|
|
163
|
-
timeout:
|
|
164
|
-
maxSize:
|
|
165
|
-
maxEvents:
|
|
161
|
+
timeout: toInt(process.env.S3_AWS_TIMEOUT, 5), // in minute
|
|
162
|
+
maxSize: toInt(process.env.S3_AWS_MAX_SIZE, 5), // in mByte
|
|
163
|
+
maxEvents: toInt(process.env.S3_AWS_MAX_EVENTS, 1000),
|
|
166
164
|
};
|
|
167
165
|
|
|
168
|
-
if (
|
|
169
|
-
if (
|
|
166
|
+
if (process.env.S3_AWS_ACCESS_KEY_ID !== undefined) configuration[AWS_S3].accessKeyId = process.env.S3_AWS_ACCESS_KEY_ID;
|
|
167
|
+
if (process.env.S3_AWS_SECRET_ACCESS_KEY !== undefined) configuration[AWS_S3].secretAccessKey = process.env.S3_AWS_SECRET_ACCESS_KEY;
|
|
170
168
|
}
|
|
171
169
|
const { filter } = configuration;
|
|
172
170
|
let filterConfig = [];
|
package/lib/common.js
CHANGED
|
@@ -53,7 +53,11 @@ const safeStringify = (obj) => {
|
|
|
53
53
|
});
|
|
54
54
|
};
|
|
55
55
|
|
|
56
|
-
const
|
|
56
|
+
const DECIMAL = 10;
|
|
57
|
+
const toInt = (value, fallback) => {
|
|
58
|
+
const parsed = parseInt(value, DECIMAL);
|
|
59
|
+
return Number.isNaN(parsed) ? fallback : parsed;
|
|
60
|
+
};
|
|
57
61
|
|
|
58
62
|
export {
|
|
59
63
|
ALL_MODE,
|
|
@@ -90,5 +94,5 @@ export {
|
|
|
90
94
|
UNKNOWN_ID,
|
|
91
95
|
WARN,
|
|
92
96
|
safeStringify,
|
|
93
|
-
|
|
97
|
+
toInt,
|
|
94
98
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mimik/sumologic-winston-logger",
|
|
3
|
-
"version": "2.1.
|
|
3
|
+
"version": "2.1.14",
|
|
4
4
|
"description": "Log wrapper for sumo, s3, kinesis and winston",
|
|
5
5
|
"main": "./index.js",
|
|
6
6
|
"type": "module",
|
|
@@ -32,9 +32,9 @@
|
|
|
32
32
|
},
|
|
33
33
|
"dependencies": {
|
|
34
34
|
"@mimik/lib-filters": "^2.0.7",
|
|
35
|
-
"@aws-sdk/client-s3": "3.
|
|
36
|
-
"@aws-sdk/client-kinesis": "3.
|
|
37
|
-
"@smithy/node-http-handler": "4.4.
|
|
35
|
+
"@aws-sdk/client-s3": "3.998.0",
|
|
36
|
+
"@aws-sdk/client-kinesis": "3.998.0",
|
|
37
|
+
"@smithy/node-http-handler": "4.4.12",
|
|
38
38
|
"axios": "1.13.5",
|
|
39
39
|
"winston": "3.19.0",
|
|
40
40
|
"winston-transport": "4.9.0"
|
|
@@ -45,7 +45,7 @@
|
|
|
45
45
|
"@mimik/request-helper": "^2.0.5",
|
|
46
46
|
"@stylistic/eslint-plugin": "5.9.0",
|
|
47
47
|
"aws-sdk-client-mock": "4.1.0",
|
|
48
|
-
"c8": "
|
|
48
|
+
"c8": "11.0.0",
|
|
49
49
|
"chai": "6.2.2",
|
|
50
50
|
"eslint": "9.39.2",
|
|
51
51
|
"eslint-plugin-import": "2.32.0",
|