@lwrjs/diagnostics 0.11.5 → 0.11.6

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.
@@ -34,6 +34,7 @@ __export(exports, {
34
34
  stringifyError: () => stringifyError
35
35
  });
36
36
  var import_errors = __toModule(require("./errors.cjs"));
37
+ var import_util = __toModule(require("util"));
37
38
  var SILENT = "silent";
38
39
  var VERBOSE = "verbose";
39
40
  var DEBUG = "debug";
@@ -76,7 +77,7 @@ function log(level, message, additionalInfo) {
76
77
  }
77
78
  }
78
79
  const logMessage = `[${level}]${gap(message)}${message}`;
79
- const additionalMessage = additionalInfo ? `Additional Info: ${JSON.stringify(additionalInfo)}` : void 0;
80
+ const additionalMessage = additionalInfo ? `Additional Info: ${(0, import_util.inspect)(additionalInfo)}` : void 0;
80
81
  if (level == ERROR) {
81
82
  console.error("%s", logMessage);
82
83
  if (additionalInfo) {
@@ -117,7 +118,7 @@ var stringifyError = (error) => {
117
118
  const descriptor = Object.getOwnPropertyDescriptor(error, property);
118
119
  retObj[property] = descriptor?.value;
119
120
  }
120
- return JSON.stringify(retObj);
121
+ return (0, import_util.inspect)(retObj);
121
122
  }
122
123
  };
123
124
  function gap(message) {
@@ -1,4 +1,5 @@
1
1
  import { DiagnosticsError } from './errors.js';
2
+ import { inspect } from 'util';
2
3
  export const SILENT = 'silent';
3
4
  export const VERBOSE = 'verbose';
4
5
  export const DEBUG = 'debug';
@@ -44,9 +45,7 @@ function log(level, message, additionalInfo) {
44
45
  }
45
46
  }
46
47
  const logMessage = `[${level}]${gap(message)}${message}`;
47
- const additionalMessage = additionalInfo
48
- ? `Additional Info: ${JSON.stringify(additionalInfo)}`
49
- : undefined;
48
+ const additionalMessage = additionalInfo ? `Additional Info: ${inspect(additionalInfo)}` : undefined;
50
49
  if (level == ERROR) {
51
50
  console.error('\x1b[31m%s\x1b[0m', logMessage); // red
52
51
  if (additionalInfo) {
@@ -91,7 +90,7 @@ export const stringifyError = (error) => {
91
90
  const descriptor = Object.getOwnPropertyDescriptor(error, property);
92
91
  retObj[property] = descriptor?.value;
93
92
  }
94
- return JSON.stringify(retObj);
93
+ return inspect(retObj);
95
94
  }
96
95
  };
97
96
  // Return a space if there should be a space between the message and the level
package/package.json CHANGED
@@ -4,7 +4,7 @@
4
4
  "publishConfig": {
5
5
  "access": "public"
6
6
  },
7
- "version": "0.11.5",
7
+ "version": "0.11.6",
8
8
  "homepage": "https://developer.salesforce.com/docs/platform/lwr/overview",
9
9
  "repository": {
10
10
  "type": "git",
@@ -35,7 +35,7 @@
35
35
  "test": "jest"
36
36
  },
37
37
  "devDependencies": {
38
- "@lwrjs/types": "0.11.5",
38
+ "@lwrjs/types": "0.11.6",
39
39
  "jest": "^26.6.3",
40
40
  "ts-jest": "^26.5.6",
41
41
  "typescript": "^4.9.5"
@@ -43,5 +43,5 @@
43
43
  "engines": {
44
44
  "node": ">=16.0.0"
45
45
  },
46
- "gitHead": "b1a54889dd55baed1bf61ceb497d251958415595"
46
+ "gitHead": "415e25c05b4b1a0356fb89801f1242e8f73143e3"
47
47
  }