@anjianshi/utils 1.0.5 → 1.0.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.
- package/env-node/logging.js +1 -1
- package/logging/adapt.js +6 -1
- package/package.json +1 -1
- package/src/env-node/logging.ts +1 -1
- package/src/logging/adapt.ts +5 -1
package/env-node/logging.js
CHANGED
|
@@ -22,7 +22,7 @@ export class ConsoleHandler extends LogHandler {
|
|
|
22
22
|
const prefix = [
|
|
23
23
|
chalk.white(`[${formatters.time(info)}]`),
|
|
24
24
|
levelColor(`[${levelName}]`),
|
|
25
|
-
loggerColor(`[${logger}]`),
|
|
25
|
+
logger ? loggerColor(`[${logger}]`) : '',
|
|
26
26
|
].join('');
|
|
27
27
|
method(prefix, ...args);
|
|
28
28
|
}
|
package/logging/adapt.js
CHANGED
|
@@ -30,7 +30,12 @@ export function adaptDebugLib(debugLib, enable = '', logger = getLogger('3rd-lib
|
|
|
30
30
|
};
|
|
31
31
|
Object.assign(debugLib, emulate);
|
|
32
32
|
// 将 debugLib 日志转发给 logger
|
|
33
|
-
debugLib.log =
|
|
33
|
+
debugLib.log = (initial, ...rest) => {
|
|
34
|
+
// 移除开头的额外空格
|
|
35
|
+
if (typeof initial === 'string')
|
|
36
|
+
initial = initial.trimStart();
|
|
37
|
+
logger.debug(initial, ...rest);
|
|
38
|
+
};
|
|
34
39
|
if (enable) {
|
|
35
40
|
debugLib.enable(enable);
|
|
36
41
|
}
|
package/package.json
CHANGED
package/src/env-node/logging.ts
CHANGED
|
@@ -31,7 +31,7 @@ export class ConsoleHandler extends LogHandler {
|
|
|
31
31
|
const prefix = [
|
|
32
32
|
chalk.white(`[${formatters.time(info)}]`),
|
|
33
33
|
levelColor(`[${levelName}]`),
|
|
34
|
-
loggerColor(`[${logger}]`),
|
|
34
|
+
logger ? loggerColor(`[${logger}]`) : '',
|
|
35
35
|
].join('')
|
|
36
36
|
method(prefix, ...args)
|
|
37
37
|
}
|
package/src/logging/adapt.ts
CHANGED
|
@@ -31,7 +31,11 @@ export function adaptDebugLib(debugLib: Debug, enable = '', logger = getLogger('
|
|
|
31
31
|
Object.assign(debugLib, emulate)
|
|
32
32
|
|
|
33
33
|
// 将 debugLib 日志转发给 logger
|
|
34
|
-
debugLib.log =
|
|
34
|
+
debugLib.log = (initial?: unknown, ...rest: unknown[]) => {
|
|
35
|
+
// 移除开头的额外空格
|
|
36
|
+
if (typeof initial === 'string') initial = initial.trimStart()
|
|
37
|
+
logger.debug(initial, ...rest)
|
|
38
|
+
}
|
|
35
39
|
|
|
36
40
|
if (enable) {
|
|
37
41
|
debugLib.enable(enable)
|