1/* 2 * Copyright (c) 2022 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 16import hiLog from '@ohos.hilog'; 17 18const TAG = 'ScreenShot-Default'; 19const DOMAIN = 0x55EE; 20const FORMAT = '%{public}s'; 21const PREFIX = '[Screenshot]'; 22const SEPARATOR = ' '; 23 24/** 25 * Basic log class 26 */ 27export default class Log { 28 /** 29 * print info level log 30 * 31 * @param {string} tag - Page or class tag 32 * @param {string} log - Log needs to be printed 33 */ 34 static showInfo(tag: string, ...args: string[]) { 35 hiLog.info(DOMAIN, PREFIX, FORMAT, `tag: ${tag} --> ${args.join(SEPARATOR)}`); 36 } 37 38 /** 39 * print debug level log 40 * 41 * @param {string} tag - Page or class tag 42 * @param {string} log - Log needs to be printed 43 */ 44 static showDebug(tag: string, ...args: string[]) { 45 hiLog.debug(DOMAIN, PREFIX, FORMAT, `tag: ${tag} --> ${args.join(SEPARATOR)}`); 46 } 47 48 /** 49 * print error level log 50 * 51 * @param {string} tag - Page or class tag 52 * @param {string} log - Log needs to be printed 53 */ 54 static showError(tag: string, ...args: string[]) { 55 hiLog.error(DOMAIN, PREFIX, FORMAT, `tag: ${tag} --> ${args.join(SEPARATOR)}`); 56 } 57} 58