From 7c73b23c17c509b0e08e289c8432ccd56a6d8c57 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=8E=8B=E7=87=95=E9=A3=9E?= Date: Fri, 21 Oct 2022 17:43:37 +0800 Subject: [PATCH] =?UTF-8?q?=E6=B7=BB=E5=8A=A0log=E5=B7=A5=E5=85=B7?= =?UTF-8?q?=E7=B1=BB?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: 王燕飞 --- entry/src/main/ets/common/Logger.ts | 30 +++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) create mode 100644 entry/src/main/ets/common/Logger.ts diff --git a/entry/src/main/ets/common/Logger.ts b/entry/src/main/ets/common/Logger.ts new file mode 100644 index 0000000..de85153 --- /dev/null +++ b/entry/src/main/ets/common/Logger.ts @@ -0,0 +1,30 @@ +import hilog from '@ohos.hilog' + +class Logger { + private domain: number + private prefix: string + private format: string = "%{public}s, %{public}s" + + constructor(prefix: string) { + this.prefix = prefix + this.domain = 0xFF00 + } + + debug(...args: any[]) { + hilog.debug(this.domain, this.prefix, this.format, args) + } + + info(...args: any[]) { + hilog.info(this.domain, this.prefix, this.format, args) + } + + warn(...args: any[]) { + hilog.warn(this.domain, this.prefix, this.format, args) + } + + error(...args: any[]) { + hilog.error(this.domain, this.prefix, this.format, args) + } +} + +export default new Logger('[MultiMedia]') \ No newline at end of file -- Gitee