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