1/* 2 * Copyright (c) 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 */ 15import hilog from '@ohos.hilog'; 16 17class Logger { 18 private tag: number; 19 private pre: string; 20 private format: string = "%{public}s, %{public}s"; 21 22 constructor() { 23 this.pre = '[Sample_Advertising]'; 24 this.tag = 0xFF00; 25 } 26 27 d(...args: any[]) { 28 hilog.debug(this.tag, this.pre, this.format, args); 29 } 30 31 i(...args: any[]) { 32 hilog.info(this.tag, this.pre, this.format, args); 33 } 34 35 w(...args: any[]) { 36 hilog.warn(this.tag, this.pre, this.format, args); 37 } 38 39 e(...args: any[]) { 40 hilog.error(this.tag, this.pre, this.format, args); 41 } 42} 43 44export default new Logger()