1/* 2 * Copyright (c) 2021 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* Provides interfaces to generate system logs. 18* 19* @since 7 20* @syscap SystemCapability.HiviewDFX.HiLog 21*/ 22 23declare namespace hilog { 24 /** 25 * Outputs debug-level logs. 26 * 27 * @param domain Indicates the service domain, which is a hexadecimal integer ranging from 0x0 to 0xFFFF 28 * @param tag Identifies the log tag. 29 * @param format Indicates the log format string. 30 * @param args Indicates the log parameters. 31 * @since 7 32 * @syscap SystemCapability.HiviewDFX.HiLog 33 */ 34 function debug(domain: number, tag: string, format: string, ...args: any[]) : void; 35 /** 36 * Outputs info-level logs. 37 * 38 * @param domain Indicates the service domain, which is a hexadecimal integer ranging from 0x0 to 0xFFFF 39 * @param tag Identifies the log tag. 40 * @param format Indicates the log format string. 41 * @param args Indicates the log parameters. 42 * @since 7 43 * @syscap SystemCapability.HiviewDFX.HiLog 44 */ 45 function info(domain: number, tag: string, format: string, ...args: any[]) : void; 46 /** 47 * Outputs warning-level logs. 48 * 49 * @param domain Indicates the service domain, which is a hexadecimal integer ranging from 0x0 to 0xFFFF 50 * @param tag Identifies the log tag. 51 * @param format Indicates the log format string. 52 * @param args Indicates the log parameters. 53 * @since 7 54 * @syscap SystemCapability.HiviewDFX.HiLog 55 */ 56 function warn(domain: number, tag: string, format: string, ...args: any[]) : void; 57 /** 58 * Outputs error-level logs. 59 * 60 * @param domain Indicates the service domain, which is a hexadecimal integer ranging from 0x0 to 0xFFFF 61 * @param tag Identifies the log tag. 62 * @param format Indicates the log format string. 63 * @param args Indicates the log parameters. 64 * @since 7 65 * @syscap SystemCapability.HiviewDFX.HiLog 66 */ 67 function error(domain: number, tag: string, format: string, ...args: any[]) : void; 68 /** 69 * Outputs fatal-level logs. 70 * 71 * @param domain Indicates the service domain, which is a hexadecimal integer ranging from 0x0 to 0xFFFF 72 * @param tag Identifies the log tag. 73 * @param format Indicates the log format string. 74 * @param args Indicates the log parameters. 75 * @since 7 76 * @syscap SystemCapability.HiviewDFX.HiLog 77 */ 78 function fatal(domain: number, tag: string, format: string, ...args: any[]) : void; 79 /** 80 * Checks whether logs of the specified tag, and level can be printed. 81 * 82 * @param domain Indicates the service domain, which is a hexadecimal integer ranging from 0x0 to 0xFFFF 83 * @param tag Identifies the log tag. 84 * @param level log level 85 * @since 7 86 * @syscap SystemCapability.HiviewDFX.HiLog 87 */ 88 function isLoggable(domain: number, tag: string, level: LogLevel) : boolean; 89 /** 90 * Log level define 91 * 92 * @since 7 93 * @syscap SystemCapability.HiviewDFX.HiLog 94 */ 95 enum LogLevel { 96 DEBUG = 3, 97 INFO = 4, 98 WARN = 5, 99 ERROR = 6, 100 FATAL = 7, 101 } 102} 103 104export default hilog;