@mimik/sumologic-winston-logger 1.6.6 → 1.6.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/.eslintrc CHANGED
@@ -12,6 +12,7 @@
12
12
  "extends": "airbnb",
13
13
  "rules": {
14
14
  "import/no-extraneous-dependencies": ["error", {"devDependencies": true}],
15
+ "import/no-unresolved": ["error", { "amd": true, "commonjs": true, "caseSensitiveStrict": true }],
15
16
  "brace-style": [1, "stroustrup", {"allowSingleLine": true}],
16
17
  "no-confusing-arrow": [0], // arrow isnt confusing
17
18
  "max-len": [1, 180, { "ignoreComments": true }],
@@ -22,12 +23,11 @@
22
23
  "@mimik/document-env/validate-document-env": 2,
23
24
  "@mimik/dependencies/case-sensitive": 2,
24
25
  "@mimik/dependencies/no-cycles": 2,
25
- "@mimik/dependencies/no-unresolved": 2,
26
26
  "@mimik/dependencies/require-json-ext": 2
27
27
  },
28
28
  "settings":{
29
29
  "react": {
30
- "version": "latest"
30
+ "version": "detect"
31
31
  }
32
32
  },
33
33
  "globals": {
package/README.md CHANGED
@@ -164,7 +164,7 @@ Listing 2 below show you how to declare a logger to run under ECMAScript 6 and t
164
164
  ``` javascript
165
165
  const logger = require('sumologic-winston-logger');
166
166
 
167
- logger.log(debug', 'this is a debug statement using log');
167
+ logger.log('debug', 'this is a debug statement using log');
168
168
  logger.debug({ message: 'this is a debug statement using an object'});
169
169
  logger.error('this is an error statement');
170
170
  logger.error(new Error('this is an error statement'));
@@ -195,4 +195,4 @@ All logging to `error()` are added the stack trace.
195
195
  All other log levels will include a line number and file name.
196
196
 
197
197
  ## License ##
198
- ISC
198
+ MIT
@@ -105,7 +105,7 @@ Listing 2 below show you how to declare a logger to run under ECMAScript 6 and t
105
105
  ``` javascript
106
106
  const logger = require('sumologic-winston-logger');
107
107
 
108
- logger.log(debug', 'this is a debug statement using log');
108
+ logger.log('debug', 'this is a debug statement using log');
109
109
  logger.debug({ message: 'this is a debug statement using an object'});
110
110
  logger.error('this is an error statement');
111
111
  logger.error(new Error('this is an error statement'));
@@ -136,4 +136,4 @@ All logging to `error()` are added the stack trace.
136
136
  All other log levels will include a line number and file name.
137
137
 
138
138
  ## License ##
139
- ISC
139
+ MIT
package/index.js CHANGED
@@ -88,6 +88,9 @@ if (config.mode.includes(AWS_KINESIS)) {
88
88
  region: config[AWS_KINESIS].region,
89
89
  accessKeyId: config[AWS_KINESIS].accessKeyId,
90
90
  secretAccessKey: config[AWS_KINESIS].secretAccessKey,
91
+ timeout: config[AWS_KINESIS].timeout,
92
+ maxEvents: config[AWS_KINESIS].maxEvents,
93
+ maxSize: config[AWS_KINESIS].maxSize,
91
94
  serverType: config.server.type,
92
95
  serverId: config.server.id,
93
96
  format: format.combine(format.timestamp(), format.json()),
@@ -1,3 +1,4 @@
1
+ /* eslint-disable no-console */
1
2
  const express = require('express');
2
3
  const bodyParser = require('body-parser');
3
4
 
@@ -10,16 +11,16 @@ const config = {
10
11
  };
11
12
 
12
13
  app.use(bodyParser.json());
13
- app.post(`${config.base}`, function (req, res) {
14
+ app.post(`${config.base}`, (req, res) => {
14
15
  i += 1;
15
16
  console.log('Recieved a POST:', i);
16
17
  // console.log('headers:', req.headers)
17
18
  console.log(req.body);
18
-
19
+
19
20
  res.statusCode = 201;
20
21
  res.send(req.body);
21
22
  });
22
23
 
23
- app.listen(config.port, () => {
24
- console.log(`event mock at ${config.port}`)
25
- })
24
+ app.listen(config.port, () => {
25
+ console.log(`event mock at ${config.port}`);
26
+ });
@@ -1,3 +1,4 @@
1
+ /* eslint-disable no-console */
1
2
  const _ = require('lodash');
2
3
 
3
4
  require('../test/testEnv');
@@ -18,15 +19,17 @@ const correlationId = 'test-12345';
18
19
  const stdin = process.openStdin();
19
20
 
20
21
  logger.info('This is a test, info', {
21
- user, test: 'this is a test', test2: 'this is a test2', test1: 'this is a test1' }, correlationId);
22
+ user, test: 'this is a test', test2: 'this is a test2', test1: 'this is a test1',
23
+ }, correlationId);
22
24
 
23
25
  logger.debug('This is a test with error', { user }, correlationId);
24
26
 
25
27
  logger.error('This is a test, error', { user }, correlationId);
26
28
 
27
- stdin.addListener('data', d => {
28
- clonedObject = _.clone(user);
29
+ stdin.addListener('data', () => {
30
+ const clonedObject = _.clone(user);
31
+
29
32
  clonedObject.index = 'manual';
30
33
  console.log('manual logging');
31
34
  logger.info('this is a test', { data: clonedObject }, correlationId);
32
- });
35
+ });
@@ -1,16 +1,15 @@
1
1
  require('../test/testEnv');
2
2
  const logger = require('../index');
3
3
 
4
-
5
4
  const complexObject = {
6
- key: 'property a',
7
- b: {
8
- c: 'property c',
9
- d: 'property d',
10
- e: {
11
- f: 'property f',
12
- },
13
- },
5
+ key: 'property a',
6
+ b: {
7
+ c: 'property c',
8
+ d: 'property d',
9
+ e: {
10
+ f: 'property f',
11
+ },
12
+ },
14
13
  };
15
14
  complexObject.g = complexObject;
16
15
  const error = new Error('an error');
@@ -39,4 +38,4 @@ logger.error('this is an error message', { user: complexObject, error, correlati
39
38
  logger.flushAndExit(1);
40
39
  // setTimeout(() => console.log('done'), 4000);
41
40
  // console.log('----------')
42
- // logger.error(error, { user: complexObject }, '6795949');
41
+ // logger.error(error, { user: complexObject }, '6795949');
@@ -1,3 +1,4 @@
1
+ /* eslint-disable no-console */
1
2
  const _ = require('lodash');
2
3
  const Promise = require('bluebird');
3
4
 
@@ -7,36 +8,35 @@ const logger = require('../index');
7
8
  const MAX_ITEMS = 100000;
8
9
 
9
10
  const complexObject = {
10
- key: 'property a',
11
- b: {
12
- c: 'property c',
13
- d: 'property d',
14
- e: {
15
- f: 'property f',
16
- },
17
- },
11
+ key: 'property a',
12
+ b: {
13
+ c: 'property c',
14
+ d: 'property d',
15
+ e: {
16
+ f: 'property f',
17
+ },
18
+ },
18
19
  };
19
20
  complexObject.g = complexObject;
20
21
  const object = {
21
- user: {
22
- userId: 'a long userid simulating a uuid',
23
- info: 'this is a test',
24
- correlationId: 'a long uuid to simulate a correaltionId',
25
- },
22
+ user: {
23
+ userId: 'a long userid simulating a uuid',
24
+ info: 'this is a test',
25
+ correlationId: 'a long uuid to simulate a correaltionId',
26
+ },
26
27
  };
27
28
  const objects = [];
28
29
 
29
- for (i = 0; i < MAX_ITEMS; i++) {
30
- clonedObject = _.clone(object);
31
- clonedObject.index = i;
32
- objects.push(clonedObject)
33
- };
30
+ for (let i = 0; i < MAX_ITEMS; i += 1) {
31
+ const clonedObject = _.clone(object);
32
+
33
+ clonedObject.index = i;
34
+ objects.push(clonedObject);
35
+ }
34
36
  const startDate = new Date();
35
37
 
36
- console.log('Test start at:', startDate.toISOString(),'with:', MAX_ITEMS, 'items');
37
- Promise.map(objects, (obj) => {
38
- return logger.info('This is a test', { data: obj }, 'test-correlation-id')
39
- }).then(() => {
40
- const endDate = new Date();
41
- console.log('Test end at:', endDate.toISOString(), 'duration:', endDate - startDate, 'with:', MAX_ITEMS, 'items');
38
+ console.log('Test start at:', startDate.toISOString(), 'with:', MAX_ITEMS, 'items');
39
+ Promise.map(objects, (obj) => logger.info('This is a test', { data: obj }, 'test-correlation-id')).then(() => {
40
+ const endDate = new Date();
41
+ console.log('Test end at:', endDate.toISOString(), 'duration:', endDate - startDate, 'with:', MAX_ITEMS, 'items');
42
42
  });
package/package.json CHANGED
@@ -1,14 +1,15 @@
1
1
  {
2
2
  "name": "@mimik/sumologic-winston-logger",
3
- "version": "1.6.6",
3
+ "version": "1.6.9",
4
4
  "description": "Log wrapper for sumo, s3, kinesis and winston",
5
5
  "main": "index.js",
6
6
  "scripts": {
7
- "lint": "gulp lint",
8
- "docs": "gulp docs",
9
- "test": "nyc gulp test",
10
- "prepublishOnly": "gulp docs; gulp lint; npm run test",
11
- "commit-ready": "gulp docs; gulp lint; npm run test",
7
+ "lint": "eslint --ignore-path .gitignore .",
8
+ "docs": "jsdoc2md configuration/config.js > README.md && cat README_Supplement.md >> README.md",
9
+ "test": "mocha --reporter mochawesome --bail --check-leaks test/",
10
+ "test-ci": "nyc --reporter=lcov --reporter=text npm test",
11
+ "prepublishOnly": "npm run docs && npm run lint && npm run test-ci",
12
+ "commit-ready": "npm run docs && npm run lint && npm run test-ci",
12
13
  "prepare": "husky install"
13
14
  },
14
15
  "husky": {
@@ -26,44 +27,39 @@
26
27
  "sumologic"
27
28
  ],
28
29
  "author": "mimik technology inc <support@mimik.com> (https://developer.mimik.com/)",
29
- "license": "Apache-2.0",
30
+ "license": "MIT",
30
31
  "repository": {
31
32
  "type": "git",
32
33
  "url": "https://bitbucket.org/mimiktech/sumologic-winston-logger"
33
34
  },
34
35
  "dependencies": {
35
- "@mimik/lib-filters": "^1.4.3",
36
- "aws-sdk": "2.1046.0",
37
- "axios": "0.24.0",
36
+ "@mimik/lib-filters": "^1.4.4",
37
+ "aws-sdk": "2.1162.0",
38
+ "axios": "0.27.2",
38
39
  "bluebird": "3.7.2",
39
40
  "lodash": "4.17.21",
40
- "winston": "3.3.3",
41
- "winston-transport": "4.4.0"
41
+ "winston": "3.8.0",
42
+ "winston-transport": "4.5.0"
42
43
  },
43
44
  "devDependencies": {
44
- "@mimik/eslint-plugin-dependencies": "^2.4.1",
45
- "@mimik/eslint-plugin-document-env": "^1.0.0",
46
- "@mimik/request-helper": "^1.7.3",
47
- "body-parser": "1.19.1",
48
- "chai": "4.3.4",
49
- "eslint": "8.4.1",
50
- "eslint-config-airbnb": "18.2.1",
51
- "eslint-plugin-import": "2.25.3",
52
- "eslint-plugin-jsx-a11y": "6.5.1",
53
- "eslint-plugin-react": "7.27.1",
54
- "eslint-plugin-react-hooks": "4.3.0",
55
- "express": "4.17.1",
56
- "fancy-log": "1.3.3",
57
- "gulp": "4.0.2",
58
- "gulp-eslint": "6.0.0",
59
- "gulp-git": "2.10.1",
60
- "gulp-spawn-mocha": "6.0.0",
61
- "husky": "7.0.4",
62
- "jsdoc-to-markdown": "7.1.0",
63
- "mocha": "9.1.3",
64
- "mochawesome": "7.0.1",
45
+ "@mimik/eslint-plugin-dependencies": "^2.4.3",
46
+ "@mimik/eslint-plugin-document-env": "^1.0.3",
47
+ "@mimik/request-helper": "^1.7.6",
48
+ "body-parser": "1.20.0",
49
+ "chai": "4.3.6",
50
+ "eslint": "8.18.0",
51
+ "eslint-config-airbnb": "19.0.4",
52
+ "eslint-plugin-import": "2.26.0",
53
+ "eslint-plugin-jsx-a11y": "6.6.0",
54
+ "eslint-plugin-react": "7.30.1",
55
+ "eslint-plugin-react-hooks": "4.6.0",
56
+ "express": "4.18.1",
57
+ "husky": "8.0.1",
58
+ "jsdoc-to-markdown": "7.1.1",
59
+ "mocha": "10.0.0",
60
+ "mochawesome": "7.1.3",
65
61
  "nyc": "15.1.0",
66
- "sinon": "12.0.1",
67
- "supertest": "6.1.6"
62
+ "sinon": "14.0.0",
63
+ "supertest": "6.2.3"
68
64
  }
69
65
  }
package/Gulpfile.js DELETED
@@ -1,49 +0,0 @@
1
- /* eslint-disable import/no-extraneous-dependencies */
2
- const eslint = require('gulp-eslint');
3
- const fs = require('fs');
4
- const git = require('gulp-git');
5
- const gulp = require('gulp');
6
- const jsdoc2md = require('jsdoc-to-markdown');
7
- const log = require('fancy-log');
8
- const mocha = require('gulp-spawn-mocha');
9
-
10
- const files = [
11
- 'index.js',
12
- 'Gulpfile.js',
13
- 'configuration/*.js',
14
- 'test/**.js',
15
- 'lib/**.js',
16
- ];
17
-
18
- const createDocs = (done) => {
19
- jsdoc2md.render({ files: 'configuration/config.js' })
20
- .then((output) => {
21
- let supplement;
22
-
23
- if (fs.existsSync('README_Supplement.md')) {
24
- supplement = fs.readFileSync('README_Supplement.md').toString();
25
- }
26
- fs.writeFileSync('README.md', output.concat(supplement));
27
- })
28
- .catch((err) => log.error('docs creation failed:', err.message))
29
- .finally(() => done());
30
- };
31
-
32
- const lint = () => gulp.src(files)
33
- .pipe(eslint({}))
34
- .pipe(eslint.format());
35
-
36
- const add = () => gulp.src('README.md')
37
- .pipe(git.add({ quiet: true }));
38
-
39
- const test = () => gulp.src(['test/*.spec.js'])
40
- .pipe(mocha({
41
- reporter: 'mochawesome',
42
- exit: true,
43
- }));
44
-
45
- const docs = gulp.series(createDocs, add);
46
-
47
- gulp.task('docs', docs);
48
- gulp.task('lint', lint);
49
- gulp.task('test', test);
@@ -1,37 +0,0 @@
1
- const got = require('got');
2
-
3
- const SUMOLOGIC = 'Sumo Logic';
4
-
5
- const endpoint = 'https://endpoint2.collection.us2.sumologic.com/receiver/v1/http/';
6
- const code = 'a code';
7
- const data = {
8
- test: 'this is a test',
9
- prop: {
10
- a: 'prop a',
11
- b: 'prop b',
12
- },
13
- };
14
-
15
-
16
- got({
17
- method: 'POST',
18
- url: `${endpoint}${code}`,
19
- json: data,
20
- throwHttpErrors: false,
21
- })
22
- .then((response) => {
23
- const { statusCode } = response;
24
-
25
- if (statusCode >=200 && statusCode < 300 ) return console.log(`message sent to ${SUMOLOGIC}`);
26
- const resp = { error: { statusCode: statusCode || 500 }, endpoint };
27
-
28
- if (statusCode >= 500) resp.error.message = `${SUMOLOGIC} is not reachable`;
29
- else if (statusCode === 401) {
30
- resp.error.message = `invalid ${SUMOLOGIC} code`;
31
- resp.code = code;
32
- }
33
- else if (statusCode === 404) resp.error.message = `invalid ${SUMOLOGIC} endpoint`;
34
- else resp.error.message = `could not log to ${SUMOLOGIC}`;
35
- console.log('error sending message', resp);
36
- })
37
- .catch((err) => console.log('error sending message', { error: { code: err.code, message: err.message }, endpoint }));
@@ -1,3 +0,0 @@
1
- // process.env.LOG_MODE = 'awsS3, sumologic, awsKinesis';
2
- process.env.LOG_MODE = 'sumologic, awsKinesis, all';
3
- const logger = require('../index');
@@ -1,27 +0,0 @@
1
- const filter = require('../src-ES6/lib/filter');
2
-
3
- const object1 = {
4
- b: {
5
- e: [{
6
- name: 'test', value: 'this is a test in name value under e',
7
- },
8
- {
9
- name: 'test1', value: 'this is a test1 in name value under e',
10
- },
11
- {
12
- name: 'test2', value: 'this is a test2 in name value under e',
13
- }],
14
- },
15
- d: [{
16
- name: 'test', value: 'this is a test in name value under d',
17
- },
18
- {
19
- name: 'test1', value: 'this is a test1 in name value under d',
20
- },
21
- {
22
- name: 'test2', value: 'this is a test2 in name value under d',
23
- }],
24
- };
25
- const filterConfig1 = ['test', '*.test1', '?.test2'];
26
-
27
- console.log(filter.logs(object1, filterConfig1));