@emartech/json-logger 6.0.0 → 6.0.1

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 ADDED
@@ -0,0 +1,25 @@
1
+ {
2
+ "env": {
3
+ "node": true,
4
+ "mocha": true,
5
+ "es6": true
6
+ },
7
+ "parser": "@typescript-eslint/parser",
8
+ "parserOptions": {
9
+ "ecmaFeatures": {
10
+ "impliedStrict": true
11
+ }
12
+ },
13
+ "globals": {
14
+ "expect": true
15
+ },
16
+ "rules": {
17
+ "security/detect-object-injection": 0,
18
+ "security/detect-non-literal-regexp": 0,
19
+ "no-unused-expressions": 0,
20
+ "func-style": 0
21
+ },
22
+ "extends": [
23
+ "emarsys"
24
+ ]
25
+ }
@@ -1,4 +1,4 @@
1
- 'use strict';
1
+ "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.logentriesFormatter = void 0;
4
4
  const isNumeric = (value) => !isNaN(parseFloat(value)) && isFinite(value);
@@ -76,18 +76,18 @@ class Logger {
76
76
  if (!stack) {
77
77
  return;
78
78
  }
79
- return stack.length > STACK_TRACE_LIMIT
80
- ? stack.substring(0, STACK_TRACE_LIMIT) + ' ...'
81
- : stack;
79
+ return stack.length > STACK_TRACE_LIMIT ?
80
+ stack.substring(0, STACK_TRACE_LIMIT) + ' ...' :
81
+ stack;
82
82
  }
83
83
  _shortenData(data) {
84
84
  if (typeof data === 'undefined') {
85
85
  return;
86
86
  }
87
87
  const stringifiedData = typeof data === 'object' ? JSON.stringify(data) : data;
88
- return stringifiedData.length > DATA_LIMIT
89
- ? stringifiedData.substring(0, DATA_LIMIT) + ' ...'
90
- : stringifiedData;
88
+ return stringifiedData.length > DATA_LIMIT ?
89
+ stringifiedData.substring(0, DATA_LIMIT) + ' ...' :
90
+ stringifiedData;
91
91
  }
92
92
  _getErrorDetails(error) {
93
93
  if (!(error instanceof Object)) {
@@ -102,8 +102,9 @@ class Logger {
102
102
  return Object.assign(baseDetails, this._getAxiosErrorDetails(error));
103
103
  }
104
104
  _getAxiosErrorDetails(error) {
105
- if (!error.isAxiosError)
105
+ if (!error.isAxiosError) {
106
106
  return {};
107
+ }
107
108
  return {
108
109
  request_method: error.config.method,
109
110
  request_url: error.config.url,
package/package.json CHANGED
@@ -1,11 +1,12 @@
1
1
  {
2
2
  "name": "@emartech/json-logger",
3
- "version": "6.0.0",
3
+ "version": "6.0.1",
4
4
  "description": "Tiny and fast json logger with namespace support",
5
5
  "main": "dist/index.js",
6
6
  "scripts": {
7
- "test": "mocha --require ts-node/register ./src/ --recursive",
8
- "test:watch": "mocha --require ts-node/register ./src/ --recursive --watch",
7
+ "test": "mocha --require ts-node/register ./src --recursive",
8
+ "test:watch": "mocha --require ts-node/register ./src --recursive --watch",
9
+ "lint": "eslint ./src/**/*.{ts,js}",
9
10
  "build": "rm -rf dist && tsc --project ./tsconfig.json",
10
11
  "semantic-release": "CI=true semantic-release",
11
12
  "example-js": "DEBUG=* node examples/index-js.js",
@@ -33,7 +34,12 @@
33
34
  "devDependencies": {
34
35
  "@emartech/cls-adapter": "1.3.0",
35
36
  "@types/node": "18.7.2",
37
+ "@typescript-eslint/parser": "5.35.1",
36
38
  "chai": "4.3.6",
39
+ "eslint": "7.21.0",
40
+ "eslint-config-emarsys": "5.1.0",
41
+ "eslint-plugin-no-only-tests": "2.4.0",
42
+ "eslint-plugin-security": "1.4.0",
37
43
  "express": "4.18.1",
38
44
  "koa": "2.13.4",
39
45
  "mocha": "10.0.0",