Skip to content

Commit

Permalink
feat: improve browser logs (#5810)
Browse files Browse the repository at this point in the history
  • Loading branch information
Pooya Parsa authored and clarkdo committed May 27, 2019
1 parent 1f74362 commit 09620d5
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions packages/vue-app/template/client.js
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -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()
}
Expand Down

0 comments on commit 09620d5

Please sign in to comment.