update common/src/main/ets/default/Log.ets.

Signed-off-by: 吕布布的耳朵 <shengli9@huawei.com>
This commit is contained in:
吕布布的耳朵 2023-05-23 08:04:47 +00:00 committed by Gitee
parent 137e1365c2
commit 1541c03e1a
No known key found for this signature in database
GPG Key ID: 173E9B9CA92EEF8F

View File

@ -13,22 +13,26 @@
* limitations under the License.
*/
const TAG = 'ScreenShot-Default';
import hiLog from '@ohos.hilog';
const TAG = 'ScreenShot-Default';
const DOMAIN = 0x55EE;
const FORMAT = '%{public}s';
const PREFIX = '[Screenshot]';
const SEPARATOR = ' ';
/**
* Basic log class
*/
export default class Log {
/**
* print info level log
*
* @param {string} tag - Page or class tag
* @param {string} log - Log needs to be printed
*/
static showInfo(tag, log) {
console.info(`${TAG} tag: ${tag} --> ${log}`);
static showInfo(tag, ...args: any[]) {
hiLog.info(DOMAIN, PREFIX, FORMAT, `tag: ${tag} --> ${args.join(SEPARATOR)}`);
}
/**
@ -37,8 +41,8 @@ export default class Log {
* @param {string} tag - Page or class tag
* @param {string} log - Log needs to be printed
*/
static showDebug(tag, log) {
console.debug(`${TAG} tag: ${tag} --> ${log}`);
static showDebug(tag, ...args: any[]) {
hiLog.debug(DOMAIN, PREFIX, FORMAT, `tag: ${tag} --> ${args.join(SEPARATOR)}`);
}
/**
@ -47,7 +51,8 @@ export default class Log {
* @param {string} tag - Page or class tag
* @param {string} log - Log needs to be printed
*/
static showError(tag, log) {
console.error(`${TAG} tag: ${tag} --> ${log}`);
static showError(tag, ...args: any[]) {
hiLog.error(DOMAIN, PREFIX, FORMAT, `tag: ${tag} --> ${args.join(SEPARATOR)}`);
}
}