From 3cc3cc7b577d3e4b1622f64cc1b57acc904ec3f7 Mon Sep 17 00:00:00 2001 From: hughfenghen Date: Mon, 25 Nov 2024 16:19:26 +0800 Subject: [PATCH] fix: setLogLevel does not take effect on the log printed during init #329 --- .changeset/polite-shrimps-fail.md | 5 +++++ packages/internal-utils/src/log.ts | 8 +++++--- 2 files changed, 10 insertions(+), 3 deletions(-) create mode 100644 .changeset/polite-shrimps-fail.md diff --git a/.changeset/polite-shrimps-fail.md b/.changeset/polite-shrimps-fail.md new file mode 100644 index 00000000..df15e802 --- /dev/null +++ b/.changeset/polite-shrimps-fail.md @@ -0,0 +1,5 @@ +--- +'@webav/internal-utils': patch +--- + +fix: setLogLevel does not take effect on the log printed during init #329 diff --git a/packages/internal-utils/src/log.ts b/packages/internal-utils/src/log.ts index 3332a2cd..d4a1445e 100644 --- a/packages/internal-utils/src/log.ts +++ b/packages/internal-utils/src/log.ts @@ -92,11 +92,13 @@ map.set(Log.error, 3); declare const PKG_VERSION: string; -(function init() { +(async function init() { + await Promise.resolve(); if (globalThis.navigator == null) return; - Log.info(`@webav version: ${PKG_VERSION}`); + Log.info( + `@webav version: ${PKG_VERSION}, date: ${new Date().toLocaleDateString()}`, + ); Log.info(globalThis.navigator.userAgent); - Log.info('date: ' + new Date().toLocaleDateString()); })(); if (import.meta.env?.DEV) {