@abtnode/logger 1.16.20-beta-e363262e → 1.16.20-beta-bb1cd034
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/lib/logger.js +11 -0
- package/package.json +3 -3
package/lib/logger.js
CHANGED
|
@@ -14,6 +14,11 @@ if (!process.env.ABT_NODE_LOG_NAME) {
|
|
|
14
14
|
process.env.ABT_NODE_LOG_NAME = 'daemon';
|
|
15
15
|
}
|
|
16
16
|
|
|
17
|
+
/**
|
|
18
|
+
* @typedef {import('prettier').LiteralUnion<'error' | 'warn' | 'info' | 'verbose' | 'debug' | 'silly', string>} LoggerLabel
|
|
19
|
+
*/
|
|
20
|
+
|
|
21
|
+
/** @type {Map<LoggerLabel, import('winston').Logger>} */
|
|
17
22
|
const instanceMap = new Map();
|
|
18
23
|
|
|
19
24
|
const getNoopLogger = (label = '') => {
|
|
@@ -165,6 +170,12 @@ const initLogger =
|
|
|
165
170
|
return logger;
|
|
166
171
|
};
|
|
167
172
|
|
|
173
|
+
/**
|
|
174
|
+
* @description
|
|
175
|
+
* @param {LoggerLabel} [label='']
|
|
176
|
+
* @param {any} [options={}]
|
|
177
|
+
* @return {import('winston').Logger}
|
|
178
|
+
*/
|
|
168
179
|
const getLogger = (label = '', options = {}) => {
|
|
169
180
|
if (!instanceMap.has(label)) {
|
|
170
181
|
instanceMap.set(label, initLogger(label)({ retain: LOG_RETAIN_IN_DAYS, ...options }));
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@abtnode/logger",
|
|
3
|
-
"version": "1.16.20-beta-
|
|
3
|
+
"version": "1.16.20-beta-bb1cd034",
|
|
4
4
|
"description": "ABT Node logger lib",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"logger",
|
|
@@ -34,7 +34,7 @@
|
|
|
34
34
|
"url": "https://github.com/ArcBlock/blocklet-server/issues"
|
|
35
35
|
},
|
|
36
36
|
"dependencies": {
|
|
37
|
-
"@abtnode/constant": "1.16.20-beta-
|
|
37
|
+
"@abtnode/constant": "1.16.20-beta-bb1cd034",
|
|
38
38
|
"debug": "^4.3.4",
|
|
39
39
|
"fast-safe-stringify": "^2.1.1",
|
|
40
40
|
"fs-extra": "^10.1.0",
|
|
@@ -47,5 +47,5 @@
|
|
|
47
47
|
"devDependencies": {
|
|
48
48
|
"express": "^4.18.2"
|
|
49
49
|
},
|
|
50
|
-
"gitHead": "
|
|
50
|
+
"gitHead": "b000d880478911fbad7f5b197daf8a9065463ca8"
|
|
51
51
|
}
|