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 * Sets the lowest log level of the current application process. 247 * 248 * @param { LogLevel } level log level 249 * @syscap SystemCapability.HiviewDFX.HiLog 250 * @atomicservice 251 * @since 15 252 */ 253 function setMinLogLevel(level: LogLevel): void; 254 255 /** 256 * Log level define 257 * 258 * @syscap SystemCapability.HiviewDFX.HiLog 259 * @since 7 260 */ 261 /** 262 * Log level define 263 * 264 * @enum { number } 265 * @syscap SystemCapability.HiviewDFX.HiLog 266 * @crossplatform 267 * @since 10 268 */ 269 /** 270 * Log level define 271 * 272 * @enum { number } 273 * @syscap SystemCapability.HiviewDFX.HiLog 274 * @crossplatform 275 * @atomicservice 276 * @since 11 277 */ 278 enum LogLevel { 279 /** 280 * DEBUG Log level define 281 * 282 * @syscap SystemCapability.HiviewDFX.HiLog 283 * @since 7 284 */ 285 /** 286 * DEBUG Log level define 287 * 288 * @syscap SystemCapability.HiviewDFX.HiLog 289 * @crossplatform 290 * @since 10 291 */ 292 /** 293 * DEBUG Log level define 294 * 295 * @syscap SystemCapability.HiviewDFX.HiLog 296 * @crossplatform 297 * @atomicservice 298 * @since 11 299 */ 300 DEBUG = 3, 301 /** 302 * INFO Log level define 303 * 304 * @syscap SystemCapability.HiviewDFX.HiLog 305 * @since 7 306 */ 307 /** 308 * INFO Log level define 309 * 310 * @syscap SystemCapability.HiviewDFX.HiLog 311 * @crossplatform 312 * @since 10 313 */ 314 /** 315 * INFO Log level define 316 * 317 * @syscap SystemCapability.HiviewDFX.HiLog 318 * @crossplatform 319 * @atomicservice 320 * @since 11 321 */ 322 INFO = 4, 323 /** 324 * WARN Log level define 325 * 326 * @syscap SystemCapability.HiviewDFX.HiLog 327 * @since 7 328 */ 329 /** 330 * WARN Log level define 331 * 332 * @syscap SystemCapability.HiviewDFX.HiLog 333 * @crossplatform 334 * @since 10 335 */ 336 /** 337 * WARN Log level define 338 * 339 * @syscap SystemCapability.HiviewDFX.HiLog 340 * @crossplatform 341 * @atomicservice 342 * @since 11 343 */ 344 WARN = 5, 345 /** 346 * ERROR Log level define 347 * 348 * @syscap SystemCapability.HiviewDFX.HiLog 349 * @since 7 350 */ 351 /** 352 * ERROR Log level define 353 * 354 * @syscap SystemCapability.HiviewDFX.HiLog 355 * @crossplatform 356 * @since 10 357 */ 358 /** 359 * ERROR Log level define 360 * 361 * @syscap SystemCapability.HiviewDFX.HiLog 362 * @crossplatform 363 * @atomicservice 364 * @since 11 365 */ 366 ERROR = 6, 367 /** 368 * FATAL Log level define 369 * 370 * @syscap SystemCapability.HiviewDFX.HiLog 371 * @since 7 372 */ 373 /** 374 * FATAL Log level define 375 * 376 * @syscap SystemCapability.HiviewDFX.HiLog 377 * @crossplatform 378 * @since 10 379 */ 380 /** 381 * FATAL Log level define 382 * 383 * @syscap SystemCapability.HiviewDFX.HiLog 384 * @crossplatform 385 * @atomicservice 386 * @since 11 387 */ 388 FATAL = 7 389 } 390} 391 392export default hilog;