From 7972d50859702db71f121013eb4bee0ae8d3c2c0 Mon Sep 17 00:00:00 2001 From: devin Date: Wed, 13 Dec 2023 15:29:44 +0800 Subject: [PATCH 1/7] =?UTF-8?q?feat:=20=E5=A2=9E=E5=8A=A0log=E5=8D=95?= =?UTF-8?q?=E4=BE=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- packages/opendesign/src/_utils/log.ts | 32 +++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) create mode 100644 packages/opendesign/src/_utils/log.ts diff --git a/packages/opendesign/src/_utils/log.ts b/packages/opendesign/src/_utils/log.ts new file mode 100644 index 00000000..08234aea --- /dev/null +++ b/packages/opendesign/src/_utils/log.ts @@ -0,0 +1,32 @@ +const logFunction = { + info: console.info, + warn: console.warn, + error: console.error, +}; + +export type LogLevel = keyof typeof logFunction; + +function printLog(level: LogLevel, ...msg: any[]) { + const fn = logFunction[level]; + if (fn) { + fn(...msg); + } +} + +export class Log { + info(...msg: any[]) { + printLog('info', ...msg); + } + + warn(...msg: any[]) { + printLog('warn', ...msg); + } + + error(...msg: any[]) { + printLog('error', ...msg); + } +} + +const logger = new Log(); + +export default logger; -- Gitee From ad281109f111ae3453cd655834ec8b6224f68fe8 Mon Sep 17 00:00:00 2001 From: devin Date: Wed, 13 Dec 2023 15:43:08 +0800 Subject: [PATCH 2/7] =?UTF-8?q?feat:=20log=E5=A2=9E=E5=8A=A0namespace?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- packages/opendesign/src/_utils/log.ts | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/packages/opendesign/src/_utils/log.ts b/packages/opendesign/src/_utils/log.ts index 08234aea..903fd9e6 100644 --- a/packages/opendesign/src/_utils/log.ts +++ b/packages/opendesign/src/_utils/log.ts @@ -14,15 +14,31 @@ function printLog(level: LogLevel, ...msg: any[]) { } export class Log { + prefix: string; + constructor(namespace?: string) { + this.prefix = ''; + if (namespace) { + this.prefix = `[${namespace}]`; + } + } info(...msg: any[]) { + if (this.prefix) { + msg.unshift(this.prefix); + } printLog('info', ...msg); } warn(...msg: any[]) { + if (this.prefix) { + msg.unshift(this.prefix); + } printLog('warn', ...msg); } error(...msg: any[]) { + if (this.prefix) { + msg.unshift(this.prefix); + } printLog('error', ...msg); } } -- Gitee From 85bd6db2f2b46e0d88ffba11124fd3c9289da14b Mon Sep 17 00:00:00 2001 From: devin Date: Wed, 13 Dec 2023 15:44:05 +0800 Subject: [PATCH 3/7] =?UTF-8?q?Oflex=E5=A2=9E=E5=8A=A0deprecatedt=E6=8F=90?= =?UTF-8?q?=E7=A4=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- packages/opendesign/src/flex/OFlex.vue | 3 +++ packages/opendesign/src/index.ts | 2 +- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/packages/opendesign/src/flex/OFlex.vue b/packages/opendesign/src/flex/OFlex.vue index 6dbb2942..276ba6b6 100644 --- a/packages/opendesign/src/flex/OFlex.vue +++ b/packages/opendesign/src/flex/OFlex.vue @@ -1,4 +1,5 @@