@mimik/sumologic-winston-logger 2.1.7 → 2.1.9
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/README.md +1 -1
- package/configuration/config.js +1 -1
- package/eslint.config.js +3 -1
- package/lib/awsKinesisTransport.js +3 -2
- package/lib/awsS3Transport.js +3 -4
- package/lib/common.js +2 -0
- package/lib/sumologicTransport.js +4 -3
- package/package.json +18 -14
package/README.md
CHANGED
|
@@ -11,7 +11,7 @@ The following environment variables are used to configure the logger:
|
|
|
11
11
|
| LOG_LEVEL | Log level for the running instance | debug | |
|
|
12
12
|
| CONSOLE_LEVEL | Console log level | debug | |
|
|
13
13
|
| FILTER_FILE | Filename containing filter rules | null | |
|
|
14
|
-
| EXIT_DELAY | Delay before exiting gracefully | 2000 | in
|
|
14
|
+
| EXIT_DELAY | Delay before exiting gracefully | 2000 | in millisecond |
|
|
15
15
|
| NO_STACK | Whether to include call stacks in all log messages | no | expected: yes/no |
|
|
16
16
|
| LOG_MODE | Comma-separated list defining the log mode/backends | sumologic | enum: awsS3, awsKinesis, sumologic, all, none |
|
|
17
17
|
|
package/configuration/config.js
CHANGED
|
@@ -33,7 +33,7 @@ const DECIMAL = 10;
|
|
|
33
33
|
* | LOG_LEVEL | Log level for the running instance | debug | |
|
|
34
34
|
* | CONSOLE_LEVEL | Console log level | debug | |
|
|
35
35
|
* | FILTER_FILE | Filename containing filter rules | null | |
|
|
36
|
-
* | EXIT_DELAY | Delay before exiting gracefully | 2000 | in
|
|
36
|
+
* | EXIT_DELAY | Delay before exiting gracefully | 2000 | in millisecond |
|
|
37
37
|
* | NO_STACK | Whether to include call stacks in all log messages | no | expected: yes/no |
|
|
38
38
|
* | LOG_MODE | Comma-separated list defining the log mode/backends | sumologic | enum: awsS3, awsKinesis, sumologic, all, none |
|
|
39
39
|
*
|
package/eslint.config.js
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import globals from 'globals';
|
|
1
2
|
import importPlugin from 'eslint-plugin-import';
|
|
2
3
|
import js from '@eslint/js';
|
|
3
4
|
import processDoc from '@mimik/eslint-plugin-document-env';
|
|
@@ -10,7 +11,7 @@ const MAX_LINES_IN_FUNCTION = 150;
|
|
|
10
11
|
const MAX_STATEMENTS_IN_FUNCTION = 45;
|
|
11
12
|
const MIN_KEYS_IN_OBJECT = 10;
|
|
12
13
|
const MAX_COMPLEXITY = 30;
|
|
13
|
-
const ECMA_VERSION =
|
|
14
|
+
const ECMA_VERSION = 'latest';
|
|
14
15
|
const MAX_DEPTH = 6;
|
|
15
16
|
const ALLOWED_CONSTANTS = [0, 1, -1];
|
|
16
17
|
|
|
@@ -28,6 +29,7 @@ export default [
|
|
|
28
29
|
languageOptions: {
|
|
29
30
|
ecmaVersion: ECMA_VERSION,
|
|
30
31
|
globals: {
|
|
32
|
+
...globals.nodeBuiltin,
|
|
31
33
|
console: 'readonly',
|
|
32
34
|
describe: 'readonly',
|
|
33
35
|
it: 'readonly',
|
|
@@ -6,6 +6,7 @@ import {
|
|
|
6
6
|
LOG,
|
|
7
7
|
MEGA,
|
|
8
8
|
MESSAGE,
|
|
9
|
+
MILLI_MIN,
|
|
9
10
|
OTHER,
|
|
10
11
|
PARTITION_KEY,
|
|
11
12
|
SYSTEM_ERROR,
|
|
@@ -41,7 +42,7 @@ export default class AwsKinesis extends Transport {
|
|
|
41
42
|
this.name = AWS_KINESIS;
|
|
42
43
|
this.maxSize = MEGA * options.maxSize;
|
|
43
44
|
this.maxEvents = options.maxEvents;
|
|
44
|
-
this.timeInterval = options.timeout;
|
|
45
|
+
this.timeInterval = MILLI_MIN * options.timeout;
|
|
45
46
|
this.streamNameInfo = options.streamNameInfo;
|
|
46
47
|
this.streamNameError = options.streamNameError;
|
|
47
48
|
this.streamNameOther = options.streamNameOther;
|
|
@@ -91,7 +92,7 @@ export default class AwsKinesis extends Transport {
|
|
|
91
92
|
|
|
92
93
|
send(Records, lvl) {
|
|
93
94
|
return this.put(Records, lvl)
|
|
94
|
-
.then(() => this.emit(LOG, { message: `
|
|
95
|
+
.then(() => this.emit(LOG, { message: `logs sent to ${AWS_KINESIS}` }))
|
|
95
96
|
.catch(err => this.emit(WARN, {
|
|
96
97
|
data: Records,
|
|
97
98
|
message: `could not log to ${AWS_KINESIS}`,
|
package/lib/awsS3Transport.js
CHANGED
|
@@ -4,6 +4,7 @@ import {
|
|
|
4
4
|
LOG,
|
|
5
5
|
MEGA,
|
|
6
6
|
MESSAGE,
|
|
7
|
+
MILLI_MIN,
|
|
7
8
|
SYSTEM_ERROR,
|
|
8
9
|
UNKNOWN_ID,
|
|
9
10
|
UNKNOWN_TYPE,
|
|
@@ -23,8 +24,6 @@ import Transport from 'winston-transport';
|
|
|
23
24
|
const events = {};
|
|
24
25
|
const typeEvents = {};
|
|
25
26
|
|
|
26
|
-
const MILLI_MIN = 60000; // 1000*60 conversion to minute
|
|
27
|
-
|
|
28
27
|
export default class AwsS3 extends Transport {
|
|
29
28
|
constructor(options = {}) {
|
|
30
29
|
super(options);
|
|
@@ -40,7 +39,7 @@ export default class AwsS3 extends Transport {
|
|
|
40
39
|
region: options.region,
|
|
41
40
|
};
|
|
42
41
|
if (options.accessKeyId && options.secretAccessKey) {
|
|
43
|
-
this.
|
|
42
|
+
this.s3ClientConfig.credentials = {
|
|
44
43
|
accessKeyId: options.accessKeyId,
|
|
45
44
|
secretAccessKey: options.secretAccessKey,
|
|
46
45
|
};
|
|
@@ -78,7 +77,7 @@ export default class AwsS3 extends Transport {
|
|
|
78
77
|
|
|
79
78
|
send(data, lvl, date) {
|
|
80
79
|
return this.put(data, lvl, date)
|
|
81
|
-
.then(() => this.emit(LOG, { message: `
|
|
80
|
+
.then(() => this.emit(LOG, { message: `logs sent to ${AWS_S3}` }))
|
|
82
81
|
.catch(err => this.emit(WARN, {
|
|
83
82
|
data,
|
|
84
83
|
message: `could not log to ${AWS_S3}`,
|
package/lib/common.js
CHANGED
|
@@ -55,6 +55,7 @@ const FLUSH_TIMEOUT = 1000; // in millisecond
|
|
|
55
55
|
const OK_EXIT = 0;
|
|
56
56
|
|
|
57
57
|
const MEGA = 1048576; // 2^20 conversion to mega
|
|
58
|
+
const MILLI_MIN = 60000; // 1000*60 conversion to minute
|
|
58
59
|
|
|
59
60
|
export {
|
|
60
61
|
ALL_MODE,
|
|
@@ -73,6 +74,7 @@ export {
|
|
|
73
74
|
LEVEL,
|
|
74
75
|
LOG,
|
|
75
76
|
MEGA,
|
|
77
|
+
MILLI_MIN,
|
|
76
78
|
MESSAGE,
|
|
77
79
|
NONE_MODE,
|
|
78
80
|
NOT_FOUND_ERROR,
|
|
@@ -12,6 +12,7 @@ import {
|
|
|
12
12
|
} from './common.js';
|
|
13
13
|
import Transport from 'winston-transport';
|
|
14
14
|
import axios from 'axios';
|
|
15
|
+
import { inspect } from 'node:util';
|
|
15
16
|
import { setImmediate } from 'node:timers';
|
|
16
17
|
|
|
17
18
|
export default class Sumo extends Transport {
|
|
@@ -41,13 +42,13 @@ export default class Sumo extends Transport {
|
|
|
41
42
|
axios({
|
|
42
43
|
method: 'POST',
|
|
43
44
|
url: `${this.endpoint}${this.code}`,
|
|
44
|
-
data,
|
|
45
|
+
data: inspect(data, { depth: null, compact: false }),
|
|
45
46
|
})
|
|
46
|
-
.then(() => this.emit(LOG, { message: `
|
|
47
|
+
.then(() => this.emit(LOG, { message: `logs sent to ${SUMOLOGIC}` }))
|
|
47
48
|
.catch((err) => {
|
|
48
49
|
const { response } = err;
|
|
49
50
|
|
|
50
|
-
const resp = { endpoint: this.endpoint, info, message: `
|
|
51
|
+
const resp = { endpoint: this.endpoint, info, message: `could not log to ${SUMOLOGIC}` };
|
|
51
52
|
|
|
52
53
|
if (info && info[SPLAT] && Array.isArray(info[SPLAT])) [, resp.correlationId] = info[SPLAT];
|
|
53
54
|
if (!response) {
|
package/package.json
CHANGED
|
@@ -1,9 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mimik/sumologic-winston-logger",
|
|
3
|
-
"version": "2.1.
|
|
3
|
+
"version": "2.1.9",
|
|
4
4
|
"description": "Log wrapper for sumo, s3, kinesis and winston",
|
|
5
5
|
"main": "./index.js",
|
|
6
6
|
"type": "module",
|
|
7
|
+
"engines": {
|
|
8
|
+
"node": ">=24.0.0"
|
|
9
|
+
},
|
|
7
10
|
"scripts": {
|
|
8
11
|
"lint": "eslint . --no-error-on-unmatched-pattern",
|
|
9
12
|
"docs": "jsdoc2md configuration/config.js > README.md && cat README_Supplement.md >> README.md",
|
|
@@ -34,10 +37,10 @@
|
|
|
34
37
|
},
|
|
35
38
|
"dependencies": {
|
|
36
39
|
"@mimik/lib-filters": "^2.0.4",
|
|
37
|
-
"@aws-sdk/client-s3": "3.
|
|
38
|
-
"@aws-sdk/client-kinesis": "3.
|
|
39
|
-
"@smithy/node-http-handler": "4.
|
|
40
|
-
"axios": "1.
|
|
40
|
+
"@aws-sdk/client-s3": "3.940.0",
|
|
41
|
+
"@aws-sdk/client-kinesis": "3.940.0",
|
|
42
|
+
"@smithy/node-http-handler": "4.4.5",
|
|
43
|
+
"axios": "1.13.2",
|
|
41
44
|
"bluebird": "3.7.2",
|
|
42
45
|
"lodash.difference": "4.5.0",
|
|
43
46
|
"lodash.foreach": "4.5.0",
|
|
@@ -47,24 +50,25 @@
|
|
|
47
50
|
"lodash.isundefined": "3.0.1",
|
|
48
51
|
"lodash.reject": "4.6.0",
|
|
49
52
|
"lodash.split": "4.4.2",
|
|
50
|
-
"winston": "3.
|
|
53
|
+
"winston": "3.18.3",
|
|
51
54
|
"winston-transport": "4.9.0"
|
|
52
55
|
},
|
|
53
56
|
"devDependencies": {
|
|
54
|
-
"@eslint/js": "9.
|
|
57
|
+
"@eslint/js": "9.39.1",
|
|
55
58
|
"@mimik/eslint-plugin-document-env": "^2.0.8",
|
|
56
59
|
"@mimik/request-helper": "^2.0.2",
|
|
57
|
-
"@stylistic/eslint-plugin": "5.
|
|
58
|
-
"body-parser": "2.2.
|
|
60
|
+
"@stylistic/eslint-plugin": "5.6.1",
|
|
61
|
+
"body-parser": "2.2.1",
|
|
59
62
|
"c8": "10.1.3",
|
|
60
|
-
"chai": "6.
|
|
61
|
-
"eslint": "9.
|
|
63
|
+
"chai": "6.2.1",
|
|
64
|
+
"eslint": "9.39.1",
|
|
62
65
|
"eslint-plugin-import": "2.32.0",
|
|
63
66
|
"express": "5.1.0",
|
|
67
|
+
"globals": "16.5.0",
|
|
64
68
|
"husky": "9.1.7",
|
|
65
|
-
"jsdoc-to-markdown": "9.1.
|
|
66
|
-
"mocha": "11.7.
|
|
67
|
-
"mochawesome": "7.1.
|
|
69
|
+
"jsdoc-to-markdown": "9.1.3",
|
|
70
|
+
"mocha": "11.7.5",
|
|
71
|
+
"mochawesome": "7.1.4",
|
|
68
72
|
"sinon": "21.0.0",
|
|
69
73
|
"supertest": "7.1.4"
|
|
70
74
|
}
|