feat: improve browser logs (#5810)

This commit is contained in:
Pooya Parsa 2019-05-27 13:02:53 +04:30 committed by Xin Du (Clark)
parent 1f74362d38
commit 09620d58a9

View File

@ -20,6 +20,8 @@ import { createApp, NuxtError } from './index.js'
import NuxtLink from './components/nuxt-link.<%= router.prefetchLinks ? "client" : "server" %>.js' // should be included after ./index.js
<% if (isDev) { %>import consola from 'consola'<% } %>
<% if (isDev) { %>consola.wrapConsole()<% } %>
// Component: <NuxtLink>
Vue.component(NuxtLink.name, NuxtLink)
Vue.component('NLink', NuxtLink)
@ -40,9 +42,8 @@ Object.assign(Vue.config, <%= serialize(vue.config) %>)<%= isTest ? '// eslint-d
<% if (nuxtOptions.render.ssrLog) { %>
const logs = NUXT.logs || []
if (logs.length > 0) {
console.group<%= nuxtOptions.render.ssrLog === 'collapsed' ? 'Collapsed' : '' %>("%c🚀 Nuxt.js SSR Logs", 'font-size: 110%')
const logger = consola.withScope('nuxt:ssr')
logs.forEach(logObj => logger[logObj.type](logObj))
console.group<%= nuxtOptions.render.ssrLog === 'collapsed' ? 'Collapsed' : '' %>("%c🚀 Nuxt SSR Logs", 'font-size: 110%')
logs.forEach(logObj => consola[logObj.type](logObj))
delete NUXT.logs
console.groupEnd()
}