diff --git a/cc.js b/cc.js index 0fe2d53..4b8a6e2 100644 --- a/cc.js +++ b/cc.js @@ -13,9 +13,9 @@ function deepStringify (args = []) { } } -function routeNow () { +function fromPath () { if (globalThis.process?.release?.name === 'node') { - return {} // { _from: routeNow.caller.name } // new Error().stack?.split('\n') , .match(/at (.*?) /g)[2] + return {} // { _from: fromPath.caller.name } // new Error().stack?.split('\n') , .match(/at (.*?) /g)[2] } else if (globalThis.uni && globalThis.UniApp) { return { _from: globalThis.getCurrentPages?.()?.pop?.()?.route?.substring?.(6) || 'VueApp' } } else { @@ -39,7 +39,7 @@ module.exports = console.log(deepStringify({ _at: new Date().toJSON(), _type: 'CLOG', // arguments.callee.name doesn't work in nodejs strict mode - ...routeNow(), + ...fromPath(), ...expandArgs(args) })) globalThis.UniApp || console.log(',') @@ -48,7 +48,7 @@ module.exports = console.info(deepStringify({ _at: new Date().toJSON(), _type: 'CINFO', - ...routeNow(), + ...fromPath(), ...expandArgs(args) })) globalThis.UniApp || console.log(',') @@ -57,7 +57,7 @@ module.exports = console.warn(deepStringify({ _at: new Date().toJSON(), _type: 'CWARN', - ...routeNow(), + ...fromPath(), ...expandArgs(args) })) globalThis.UniApp || console.log(',') @@ -66,7 +66,7 @@ module.exports = console.error(deepStringify({ _at: new Date().toJSON(), _type: 'CERROR', - ...routeNow(), + ...fromPath(), ...expandArgs(args) })) globalThis.UniApp || console.log(',') @@ -76,7 +76,7 @@ module.exports = console.debug(deepStringify({ _at: new Date().toJSON(), _type: 'CDEBUG', - ...routeNow(), + ...fromPath(), ...expandArgs(args) })) globalThis.UniApp || console.log(',')