fix(logger): pass the correct variable to the parameter

This commit is contained in:
curbengh 2019-12-27 03:31:33 +00:00
parent 7d163bcb00
commit 9df4e8283b
No known key found for this signature in database
GPG Key ID: 21EA847C35D6E034
1 changed files with 5 additions and 5 deletions

View File

@ -116,9 +116,9 @@ function minifySvg () {
assetPath.on('end', async () => { assetPath.on('end', async () => {
if (assetTxt.length) { if (assetTxt.length) {
try { try {
const result = await new Svgo(options).optimize(assetTxt) const { data } = await new Svgo(options).optimize(assetTxt)
if (options.logger) verbose.call(this, assetTxt.join().toString(), result.data, path, 'svg') if (options.logger) verbose.call(this, assetTxt, data, path, 'svg')
resolve(route.set(path, result.data)) resolve(route.set(path, data))
} catch (err) { } catch (err) {
reject(err) reject(err)
throw new Error(err) throw new Error(err)
@ -153,7 +153,7 @@ function gzipFn () {
// TODO: Drop Buffer // TODO: Drop Buffer
const input = Buffer.from(assetTxt, 'utf-8') const input = Buffer.from(assetTxt, 'utf-8')
const result = await gzip(input, { level: zlib.constants.Z_BEST_COMPRESSION }) const result = await gzip(input, { level: zlib.constants.Z_BEST_COMPRESSION })
if (options.logger) verbose.call(this, input, result.toString(), path, 'gzip') if (options.logger) verbose.call(this, input, result, path, 'gzip')
resolve(route.set(path + '.gz', result)) resolve(route.set(path + '.gz', result))
} catch (err) { } catch (err) {
reject(err) reject(err)
@ -188,7 +188,7 @@ function brotliFn () {
try { try {
const input = Buffer.from(assetTxt, 'utf-8') const input = Buffer.from(assetTxt, 'utf-8')
const result = await br(input) const result = await br(input)
if (options.logger) verbose.call(this, input, result.toString(), path, 'brotli') if (options.logger) verbose.call(this, input, result, path, 'brotli')
resolve(route.set(path + '.br', result)) resolve(route.set(path + '.br', result))
} catch (err) { } catch (err) {
reject(err) reject(err)