@anjianshi/utils 1.0.3 → 1.0.4
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/logging/adapt.d.ts +1 -1
- package/logging/adapt.js +1 -2
- package/package.json +1 -1
- package/src/logging/adapt.ts +1 -2
package/logging/adapt.d.ts
CHANGED
package/logging/adapt.js
CHANGED
|
@@ -2,7 +2,7 @@ import { getLogger } from './index.js';
|
|
|
2
2
|
/**
|
|
3
3
|
* 适配 debug package
|
|
4
4
|
*/
|
|
5
|
-
export function adaptDebugLib(debugLib, enable = '') {
|
|
5
|
+
export function adaptDebugLib(debugLib, enable = '', logger = getLogger('3rd-library')) {
|
|
6
6
|
// 不在 localStorage 里记录 debugLib enable 状态,
|
|
7
7
|
// 以解决 web worker 里读不到 localStorage 而无法启用 debugLib 日志的问题
|
|
8
8
|
const emulate = {
|
|
@@ -30,7 +30,6 @@ export function adaptDebugLib(debugLib, enable = '') {
|
|
|
30
30
|
};
|
|
31
31
|
Object.assign(debugLib, emulate);
|
|
32
32
|
// 将 debugLib 日志转发给 logger
|
|
33
|
-
const logger = getLogger('3rd-library');
|
|
34
33
|
debugLib.log = logger.debug.bind(logger);
|
|
35
34
|
if (enable) {
|
|
36
35
|
debugLib.enable(enable);
|
package/package.json
CHANGED
package/src/logging/adapt.ts
CHANGED
|
@@ -4,7 +4,7 @@ import { getLogger } from './index.js'
|
|
|
4
4
|
/**
|
|
5
5
|
* 适配 debug package
|
|
6
6
|
*/
|
|
7
|
-
export function adaptDebugLib(debugLib: Debug, enable = '') {
|
|
7
|
+
export function adaptDebugLib(debugLib: Debug, enable = '', logger = getLogger('3rd-library')) {
|
|
8
8
|
// 不在 localStorage 里记录 debugLib enable 状态,
|
|
9
9
|
// 以解决 web worker 里读不到 localStorage 而无法启用 debugLib 日志的问题
|
|
10
10
|
const emulate = {
|
|
@@ -31,7 +31,6 @@ export function adaptDebugLib(debugLib: Debug, enable = '') {
|
|
|
31
31
|
Object.assign(debugLib, emulate)
|
|
32
32
|
|
|
33
33
|
// 将 debugLib 日志转发给 logger
|
|
34
|
-
const logger = getLogger('3rd-library')
|
|
35
34
|
debugLib.log = logger.debug.bind(logger)
|
|
36
35
|
|
|
37
36
|
if (enable) {
|