1/* 2 * Copyright (c) 2021-2023 Huawei Device Co., Ltd. 3 * Licensed under the Apache License, Version 2.0 (the "License"); 4 * you may not use this file except in compliance with the License. 5 * You may obtain a copy of the License at 6 * 7 * http://www.apache.org/licenses/LICENSE-2.0 8 * 9 * Unless required by applicable law or agreed to in writing, software 10 * distributed under the License is distributed on an "AS IS" BASIS, 11 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 * See the License for the specific language governing permissions and 13 * limitations under the License. 14 */ 15 16/** 17 * [日志工具类]<BR> 18 * 19 */ 20// app tag 21import hilog from '@ohos.hilog' 22 23// import { LOG, HiLogNode, Logger as Hlogger } from '@hw-hmf/logger' 24 25const APP_TAG = "HwMsc_" 26const DOMAIN = 0x0001 27 28// Hlogger.config(new HiLogNode(DOMAIN)) 29export class Logger { 30 static domain: number = DOMAIN 31 prefix: string; 32 33 34 constructor(module: string | number) { 35 this.prefix = APP_TAG + module; 36 } 37 38 debug(message: string, ...args: any[]): void { 39 hilog.debug(Logger.domain, this.prefix, message, args) 40 } 41 42 log(message: string, ...args: any[]): void { 43 hilog.debug(Logger.domain, this.prefix, message, args) 44 } 45 46 info(message: string, ...args: any[]): void { 47 hilog.info(Logger.domain, this.prefix, message, args) 48 } 49 50 warn(message: string, ...args: any[]): void { 51 hilog.warn(Logger.domain, this.prefix, message, args) 52 } 53 54 error(message: string, ...args: any[]): void { 55 hilog.error(Logger.domain, this.prefix, message, args) 56 } 57} 58 59