1048147e0Sopenharmony_ci/**
2048147e0Sopenharmony_ci * Copyright (c) 2022 Huawei Device Co., Ltd.
3048147e0Sopenharmony_ci * Licensed under the Apache License, Version 2.0 (the "License");
4048147e0Sopenharmony_ci * you may not use this file except in compliance with the License.
5048147e0Sopenharmony_ci * You may obtain a copy of the License at
6048147e0Sopenharmony_ci *
7048147e0Sopenharmony_ci *     http://www.apache.org/licenses/LICENSE-2.0
8048147e0Sopenharmony_ci *
9048147e0Sopenharmony_ci * Unless required by applicable law or agreed to in writing, software
10048147e0Sopenharmony_ci * distributed under the License is distributed on an "AS IS" BASIS,
11048147e0Sopenharmony_ci * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12048147e0Sopenharmony_ci * See the License for the specific language governing permissions and
13048147e0Sopenharmony_ci * limitations under the License.
14048147e0Sopenharmony_ci */
15048147e0Sopenharmony_ci
16048147e0Sopenharmony_ci/**
17048147e0Sopenharmony_ci * Log Util
18048147e0Sopenharmony_ci *
19048147e0Sopenharmony_ci * standard :
20048147e0Sopenharmony_ci * 1. define TAG, recommend class name。
21048147e0Sopenharmony_ci * 2. switch IS_DEBUG_ON as true, when debugging.
22048147e0Sopenharmony_ci * 3. msg should be short and valuable.
23048147e0Sopenharmony_ci * 4. choose appropriate function.
24048147e0Sopenharmony_ci * 5. the function execute many times can not print.
25048147e0Sopenharmony_ci * 6. uniqueness.
26048147e0Sopenharmony_ci *
27048147e0Sopenharmony_ci * @since 2022-02-18
28048147e0Sopenharmony_ci */
29048147e0Sopenharmony_ciimport Log from '@ohos.hilog';
30048147e0Sopenharmony_ci
31048147e0Sopenharmony_ciconst TAG = 'MmsLog';
32048147e0Sopenharmony_ciconst DOMAIN = 0x0800;
33048147e0Sopenharmony_ci
34048147e0Sopenharmony_ciexport default class HiLog {
35048147e0Sopenharmony_ci
36048147e0Sopenharmony_ci    private static readonly COLON: string = ': ';
37048147e0Sopenharmony_ci
38048147e0Sopenharmony_ci    constructor() {
39048147e0Sopenharmony_ci    }
40048147e0Sopenharmony_ci
41048147e0Sopenharmony_ci    private static prefix(tag: string) {
42048147e0Sopenharmony_ci        return tag + this.COLON;
43048147e0Sopenharmony_ci    }
44048147e0Sopenharmony_ci
45048147e0Sopenharmony_ci    static d(tag: string, msg: string, ...args: any[]) {
46048147e0Sopenharmony_ci        Log.debug(DOMAIN, TAG, this.prefix(tag) + msg, args);
47048147e0Sopenharmony_ci    }
48048147e0Sopenharmony_ci
49048147e0Sopenharmony_ci    static i(tag: string, msg: string, ...args: any[]) {
50048147e0Sopenharmony_ci        Log.info(DOMAIN, TAG, this.prefix(tag) + msg, args);
51048147e0Sopenharmony_ci    }
52048147e0Sopenharmony_ci
53048147e0Sopenharmony_ci    static w(tag: string, msg: string, ...args: any[]) {
54048147e0Sopenharmony_ci        Log.warn(DOMAIN, TAG, this.prefix(tag) + msg, args);
55048147e0Sopenharmony_ci    }
56048147e0Sopenharmony_ci
57048147e0Sopenharmony_ci    static e(tag: string, msg: string, ...args: any[]) {
58048147e0Sopenharmony_ci        Log.error(DOMAIN, TAG, this.prefix(tag) + msg, args);
59048147e0Sopenharmony_ci    }
60048147e0Sopenharmony_ci}
61048147e0Sopenharmony_ci
62