fix(vue-renderer): safe format ssr logs (#5764)

This commit is contained in:
Pooya Parsa 2019-05-19 23:19:24 +04:30 committed by GitHub
parent dbb9f03959
commit 38fc721f50
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -1,5 +1,6 @@
import path from 'path'
import crypto from 'crypto'
import { format } from 'util'
import fs from 'fs-extra'
import consola from 'consola'
import devalue from '@nuxt/devalue'
@ -42,10 +43,10 @@ export default class SSRRenderer extends BaseRenderer {
const logs = []
const devReporter = {
log(logObj) {
if (logObj.args[0] instanceof Error) {
logObj.args[0] = logObj.args[0].stack
}
logs.push(logObj)
logs.push({
...logObj,
args: logObj.args.map(format)
})
}
}
consola.addReporter(devReporter)