diff --git a/packages/vue-cli-plugin-uni/lib/format-log.js b/packages/vue-cli-plugin-uni/lib/format-log.js index fb6017e8e945b8617b0dfa2ab4f55676cbc06466..f7e9dcffc6a263577d19e80dcc5f445652feb3cf 100644 --- a/packages/vue-cli-plugin-uni/lib/format-log.js +++ b/packages/vue-cli-plugin-uni/lib/format-log.js @@ -3,17 +3,24 @@ function typof (v) { return s.substring(8, s.length - 1) } -function isDebugMode () { +function isDebugMode () { /* eslint-disable no-undef */ return typeof __channelId__ === 'string' && __channelId__ } +export function log (type) { + for (var _len = arguments.length, args = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) { + args[_key - 1] = arguments[_key] + } + console[type].apply(console, args) +} + export default function formatLog () { for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) { args[_key] = arguments[_key] } var type = args.shift() - if (isDebugMode()) { + if (isDebugMode()) { args.push(args.pop().replace('at ', 'uni-app:///')) return console[type]['apply'](console, args) } diff --git a/packages/vue-cli-plugin-uni/lib/h5/index.js b/packages/vue-cli-plugin-uni/lib/h5/index.js index 10e4e8b2ad9e3062c1454822ac309cdf8a47b1e6..2f37600daec93bcac1e09fd582686012ba833734 100644 --- a/packages/vue-cli-plugin-uni/lib/h5/index.js +++ b/packages/vue-cli-plugin-uni/lib/h5/index.js @@ -34,7 +34,7 @@ const uniCloudPath = path.resolve(__dirname, '../../packages/uni-cloud/dist/inde function getProvides () { return { - '__f__': [path.resolve(__dirname, '../format-log.js'), 'default'], + '__f__': [path.resolve(__dirname, '../format-log.js'), 'log'], 'uniCloud': [uniCloudPath, 'default'], 'wx.nextTick': [runtimePath, 'nextTick'], 'Page': [runtimePath, 'Page'],