From 9b9a4718df5871f2176db52a653128b9950f6e41 Mon Sep 17 00:00:00 2001 From: jaywcjlove <398188662@qq.com> Date: Thu, 10 Nov 2022 12:21:51 +0800 Subject: [PATCH] fix: fix log options issue. (#183) --- src/index.ts | 5 ++--- src/utils.ts | 1 + test/example/index.js | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/index.ts b/src/index.ts index 2b705804..9f8c03d4 100644 --- a/src/index.ts +++ b/src/index.ts @@ -180,9 +180,8 @@ export default async (options: SvgToFontOptions = {}) => { options.website.version = pkg.version; } } - - log.disabled = options.log || false; - console.log('options.logger::', options.logger) + if (options.log === undefined) options.log = true; + log.disabled = !options.log; if (options.logger && typeof options.logger === 'function') log.logger = options.logger; options.dist = options.dist || path.join(process.cwd(), 'fonts'); options.src = options.src || path.join(process.cwd(), 'svg'); diff --git a/src/utils.ts b/src/utils.ts index ec181876..a63a8616 100644 --- a/src/utils.ts +++ b/src/utils.ts @@ -30,6 +30,7 @@ export function createSVG(options: SvgToFontOptions = {}): Promise { // init const fontStream = new SVGIcons2SVGFont({ + log: (message) => log.log(message), ...options.svgicons2svgfont }); diff --git a/test/example/index.js b/test/example/index.js index 54a97b78..98ee79a2 100644 --- a/test/example/index.js +++ b/test/example/index.js @@ -65,5 +65,5 @@ svgtofont({ } }) .then(() => { - console.log("done!"); + console.log("Example::::done!"); });