mynth-logger 1.0.7 → 1.0.8
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/dist/src/index.js +12 -6
- package/dist/tests/index.test.js +9 -4
- package/package.json +1 -1
- package/tsconfig.json +2 -2
package/dist/src/index.js
CHANGED
|
@@ -1,8 +1,14 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.setupLogging = void 0;
|
|
7
|
+
const json5_1 = __importDefault(require("json5"));
|
|
8
|
+
const pino_1 = __importDefault(require("pino"));
|
|
3
9
|
const isPinoPrettyInstalled = () => {
|
|
4
10
|
try {
|
|
5
|
-
|
|
11
|
+
(0, pino_1.default)({ transport: { target: "pino-pretty" } });
|
|
6
12
|
return true;
|
|
7
13
|
}
|
|
8
14
|
catch {
|
|
@@ -27,13 +33,13 @@ if (isPinoPrettyInstalled() && process.env.NODE_ENV != "test") {
|
|
|
27
33
|
},
|
|
28
34
|
};
|
|
29
35
|
}
|
|
30
|
-
const logger =
|
|
36
|
+
const logger = (0, pino_1.default)(pinoSettings);
|
|
31
37
|
const formatItem = (item) => {
|
|
32
38
|
// Remove colors from strings
|
|
33
39
|
if (typeof item === "string") {
|
|
34
40
|
return item.replace(/\x1b\[[0-9;]*m/g, "");
|
|
35
41
|
}
|
|
36
|
-
return
|
|
42
|
+
return json5_1.default.stringify(item).replace(/^\'|\'$/g, "");
|
|
37
43
|
};
|
|
38
44
|
const format = (items) => {
|
|
39
45
|
return Array.from(items)
|
|
@@ -59,4 +65,4 @@ const setupLogging = () => {
|
|
|
59
65
|
logger.debug(format(Array.from(arguments)));
|
|
60
66
|
};
|
|
61
67
|
};
|
|
62
|
-
|
|
68
|
+
exports.setupLogging = setupLogging;
|
package/dist/tests/index.test.js
CHANGED
|
@@ -1,7 +1,12 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
const ava_1 = __importDefault(require("ava"));
|
|
7
|
+
const index_1 = require("../src/index");
|
|
8
|
+
(0, ava_1.default)("setupLogging can be called", (t) => {
|
|
9
|
+
(0, index_1.setupLogging)();
|
|
5
10
|
console.debug("Hello ava");
|
|
6
11
|
t.pass();
|
|
7
12
|
});
|
package/package.json
CHANGED