1/* 2 * Copyright (c) 2021-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 */ 15 16/** 17 * @file 18 * @kit PerformanceAnalysisKit 19 */ 20 21/** 22* Provides interfaces to generate system logs. 23* 24* @namespace hilog 25* @syscap SystemCapability.HiviewDFX.HiLog 26* @since 7 27*/ 28/** 29* Provides interfaces to generate system logs. 30* 31* @namespace hilog 32* @syscap SystemCapability.HiviewDFX.HiLog 33* @crossplatform 34* @since 10 35*/ 36/** 37* Provides interfaces to generate system logs. 38* 39* @namespace hilog 40* @syscap SystemCapability.HiviewDFX.HiLog 41* @crossplatform 42* @atomicservice 43* @since 11 44*/ 45declare namespace hilog { 46 47 /** 48 * Outputs debug-level logs. 49 * 50 * @param { number } domain Indicates the service domain, which is a hexadecimal integer ranging from 0x0 to 0xFFFF 51 * @param { string } tag Identifies the log tag, length cannot exceed 32 bytes. 52 * @param { string } format Indicates the log format string. 53 * @param { any[] }args Indicates the log parameters. 54 * @syscap SystemCapability.HiviewDFX.HiLog 55 * @since 7 56 */ 57 /** 58 * Outputs debug-level logs. 59 * 60 * @param { number } domain Indicates the service domain, which is a hexadecimal integer ranging from 0x0 to 0xFFFF 61 * @param { string } tag Identifies the log tag, length cannot exceed 32 bytes. 62 * @param { string } format Indicates the log format string. 63 * @param { any[] }args Indicates the log parameters. 64 * @syscap SystemCapability.HiviewDFX.HiLog 65 * @crossplatform 66 * @since 10 67 */ 68 /** 69 * Outputs debug-level logs. 70 * 71 * @param { number } domain Indicates the service domain, which is a hexadecimal integer ranging from 0x0 to 0xFFFF 72 * @param { string } tag Identifies the log tag, length cannot exceed 32 bytes. 73 * @param { string } format Indicates the log format string. 74 * @param { any[] }args Indicates the log parameters. 75 * @syscap SystemCapability.HiviewDFX.HiLog 76 * @crossplatform 77 * @atomicservice 78 * @since 11 79 */ 80 function debug(domain: number, tag: string, format: string, ...args: any[]): void; 81 82 /** 83 * Outputs info-level logs. 84 * 85 * @param { number } domain Indicates the service domain, which is a hexadecimal integer ranging from 0x0 to 0xFFFF 86 * @param { string } tag Identifies the log tag, length cannot exceed 32 bytes. 87 * @param { string } format Indicates the log format string. 88 * @param { any[] }args Indicates the log parameters. 89 * @syscap SystemCapability.HiviewDFX.HiLog 90 * @since 7 91 */ 92 /** 93 * Outputs info-level logs. 94 * 95 * @param { number } domain Indicates the service domain, which is a hexadecimal integer ranging from 0x0 to 0xFFFF 96 * @param { string } tag Identifies the log tag, length cannot exceed 32 bytes. 97 * @param { string } format Indicates the log format string. 98 * @param { any[] }args Indicates the log parameters. 99 * @syscap SystemCapability.HiviewDFX.HiLog 100 * @crossplatform 101 * @since 10 102 */ 103 /** 104 * Outputs info-level logs. 105 * 106 * @param { number } domain Indicates the service domain, which is a hexadecimal integer ranging from 0x0 to 0xFFFF 107 * @param { string } tag Identifies the log tag, length cannot exceed 32 bytes. 108 * @param { string } format Indicates the log format string. 109 * @param { any[] }args Indicates the log parameters. 110 * @syscap SystemCapability.HiviewDFX.HiLog 111 * @crossplatform 112 * @atomicservice 113 * @since 11 114 */ 115 function info(domain: number, tag: string, format: string, ...args: any[]): void; 116 117 /** 118 * Outputs warning-level logs. 119 * 120 * @param { number } domain Indicates the service domain, which is a hexadecimal integer ranging from 0x0 to 0xFFFF 121 * @param { string } tag Identifies the log tag, length cannot exceed 32 bytes. 122 * @param { string } format Indicates the log format string. 123 * @param { any[] }args Indicates the log parameters. 124 * @syscap SystemCapability.HiviewDFX.HiLog 125 * @since 7 126 */ 127 /** 128 * Outputs warning-level logs. 129 * 130 * @param { number } domain Indicates the service domain, which is a hexadecimal integer ranging from 0x0 to 0xFFFF 131 * @param { string } tag Identifies the log tag, length cannot exceed 32 bytes. 132 * @param { string } format Indicates the log format string. 133 * @param { any[] }args Indicates the log parameters. 134 * @syscap SystemCapability.HiviewDFX.HiLog 135 * @crossplatform 136 * @since 10 137 */ 138 /** 139 * Outputs warning-level logs. 140 * 141 * @param { number } domain Indicates the service domain, which is a hexadecimal integer ranging from 0x0 to 0xFFFF 142 * @param { string } tag Identifies the log tag, length cannot exceed 32 bytes. 143 * @param { string } format Indicates the log format string. 144 * @param { any[] }args Indicates the log parameters. 145 * @syscap SystemCapability.HiviewDFX.HiLog 146 * @crossplatform 147 * @atomicservice 148 * @since 11 149 */ 150 function warn(domain: number, tag: string, format: string, ...args: any[]): void; 151 152 /** 153 * Outputs error-level logs. 154 * 155 * @param { number } domain Indicates the service domain, which is a hexadecimal integer ranging from 0x0 to 0xFFFF 156 * @param { string } tag Identifies the log tag, length cannot exceed 32 bytes. 157 * @param { string } format Indicates the log format string. 158 * @param { any[] }args Indicates the log parameters. 159 * @syscap SystemCapability.HiviewDFX.HiLog 160 * @since 7 161 */ 162 /** 163 * Outputs error-level logs. 164 * 165 * @param { number } domain Indicates the service domain, which is a hexadecimal integer ranging from 0x0 to 0xFFFF 166 * @param { string } tag Identifies the log tag, length cannot exceed 32 bytes. 167 * @param { string } format Indicates the log format string. 168 * @param { any[] }args Indicates the log parameters. 169 * @syscap SystemCapability.HiviewDFX.HiLog 170 * @crossplatform 171 * @since 10 172 */ 173 /** 174 * Outputs error-level logs. 175 * 176 * @param { number } domain Indicates the service domain, which is a hexadecimal integer ranging from 0x0 to 0xFFFF 177 * @param { string } tag Identifies the log tag, length cannot exceed 32 bytes. 178 * @param { string } format Indicates the log format string. 179 * @param { any[] }args Indicates the log parameters. 180 * @syscap SystemCapability.HiviewDFX.HiLog 181 * @crossplatform 182 * @atomicservice 183 * @since 11 184 */ 185 function error(domain: number, tag: string, format: string, ...args: any[]): void; 186 187 /** 188 * Outputs fatal-level logs. 189 * 190 * @param { number } domain Indicates the service domain, which is a hexadecimal integer ranging from 0x0 to 0xFFFF 191 * @param { string } tag Identifies the log tag, length cannot exceed 32 bytes. 192 * @param { string } format Indicates the log format string. 193 * @param { any[] }args Indicates the log parameters. 194 * @syscap SystemCapability.HiviewDFX.HiLog 195 * @since 7 196 */ 197 /** 198 * Outputs fatal-level logs. 199 * 200 * @param { number } domain Indicates the service domain, which is a hexadecimal integer ranging from 0x0 to 0xFFFF 201 * @param { string } tag Identifies the log tag, length cannot exceed 32 bytes. 202 * @param { string } format Indicates the log format string. 203 * @param { any[] }args Indicates the log parameters. 204 * @syscap SystemCapability.HiviewDFX.HiLog 205 * @crossplatform 206 * @since 10 207 */ 208 /** 209 * Outputs fatal-level logs. 210 * 211 * @param { number } domain Indicates the service domain, which is a hexadecimal integer ranging from 0x0 to 0xFFFF 212 * @param { string } tag Identifies the log tag, length cannot exceed 32 bytes. 213 * @param { string } format Indicates the log format string. 214 * @param { any[] }args Indicates the log parameters. 215 * @syscap SystemCapability.HiviewDFX.HiLog 216 * @crossplatform 217 * @atomicservice 218 * @since 11 219 */ 220 function fatal(domain: number, tag: string, format: string, ...args: any[]): void; 221 222 /** 223 * Checks whether logs of the specified tag, and level can be printed. 224 * 225 * @param { number } domain Indicates the service domain, which is a hexadecimal integer ranging from 0x0 to 0xFFFF 226 * @param { string } tag Identifies the log tag, length cannot exceed 32 bytes. 227 * @param { LogLevel } level log level 228 * @returns { boolean } 229 * @syscap SystemCapability.HiviewDFX.HiLog 230 * @since 7 231 */ 232 /** 233 * Checks whether logs of the specified tag, and level can be printed. 234 * 235 * @param { number } domain Indicates the service domain, which is a hexadecimal integer ranging from 0x0 to 0xFFFF 236 * @param { string } tag Identifies the log tag, length cannot exceed 32 bytes. 237 * @param { LogLevel } level log level 238 * @returns { boolean } 239 * @syscap SystemCapability.HiviewDFX.HiLog 240 * @atomicservice 241 * @since 11 242 */ 243 function isLoggable(domain: number, tag: string, level: LogLevel): boolean; 244 245 /** 246 * Log level define 247 * 248 * @syscap SystemCapability.HiviewDFX.HiLog 249 * @since 7 250 */ 251 /** 252 * Log level define 253 * 254 * @enum { number } 255 * @syscap SystemCapability.HiviewDFX.HiLog 256 * @crossplatform 257 * @since 10 258 */ 259 /** 260 * Log level define 261 * 262 * @enum { number } 263 * @syscap SystemCapability.HiviewDFX.HiLog 264 * @crossplatform 265 * @atomicservice 266 * @since 11 267 */ 268 enum LogLevel { 269 /** 270 * DEBUG Log level define 271 * 272 * @syscap SystemCapability.HiviewDFX.HiLog 273 * @since 7 274 */ 275 /** 276 * DEBUG Log level define 277 * 278 * @syscap SystemCapability.HiviewDFX.HiLog 279 * @crossplatform 280 * @since 10 281 */ 282 /** 283 * DEBUG Log level define 284 * 285 * @syscap SystemCapability.HiviewDFX.HiLog 286 * @crossplatform 287 * @atomicservice 288 * @since 11 289 */ 290 DEBUG = 3, 291 /** 292 * INFO Log level define 293 * 294 * @syscap SystemCapability.HiviewDFX.HiLog 295 * @since 7 296 */ 297 /** 298 * INFO Log level define 299 * 300 * @syscap SystemCapability.HiviewDFX.HiLog 301 * @crossplatform 302 * @since 10 303 */ 304 /** 305 * INFO Log level define 306 * 307 * @syscap SystemCapability.HiviewDFX.HiLog 308 * @crossplatform 309 * @atomicservice 310 * @since 11 311 */ 312 INFO = 4, 313 /** 314 * WARN Log level define 315 * 316 * @syscap SystemCapability.HiviewDFX.HiLog 317 * @since 7 318 */ 319 /** 320 * WARN Log level define 321 * 322 * @syscap SystemCapability.HiviewDFX.HiLog 323 * @crossplatform 324 * @since 10 325 */ 326 /** 327 * WARN Log level define 328 * 329 * @syscap SystemCapability.HiviewDFX.HiLog 330 * @crossplatform 331 * @atomicservice 332 * @since 11 333 */ 334 WARN = 5, 335 /** 336 * ERROR Log level define 337 * 338 * @syscap SystemCapability.HiviewDFX.HiLog 339 * @since 7 340 */ 341 /** 342 * ERROR Log level define 343 * 344 * @syscap SystemCapability.HiviewDFX.HiLog 345 * @crossplatform 346 * @since 10 347 */ 348 /** 349 * ERROR Log level define 350 * 351 * @syscap SystemCapability.HiviewDFX.HiLog 352 * @crossplatform 353 * @atomicservice 354 * @since 11 355 */ 356 ERROR = 6, 357 /** 358 * FATAL Log level define 359 * 360 * @syscap SystemCapability.HiviewDFX.HiLog 361 * @since 7 362 */ 363 /** 364 * FATAL Log level define 365 * 366 * @syscap SystemCapability.HiviewDFX.HiLog 367 * @crossplatform 368 * @since 10 369 */ 370 /** 371 * FATAL Log level define 372 * 373 * @syscap SystemCapability.HiviewDFX.HiLog 374 * @crossplatform 375 * @atomicservice 376 * @since 11 377 */ 378 FATAL = 7 379 } 380} 381 382export default hilog;