• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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/*** if arkts 1.2 */
22import { RecordData } from '@ohos.base';
23/*** endif */
24
25/**
26 * Provides interfaces to generate system logs.
27 *
28 * @namespace hilog
29 * @syscap SystemCapability.HiviewDFX.HiLog
30 * @since 7
31 */
32/**
33 * Provides interfaces to generate system logs.
34 *
35 * @namespace hilog
36 * @syscap SystemCapability.HiviewDFX.HiLog
37 * @crossplatform
38 * @since 10
39 */
40/**
41 * Provides interfaces to generate system logs.
42 *
43 * @namespace hilog
44 * @syscap SystemCapability.HiviewDFX.HiLog
45 * @crossplatform
46 * @atomicservice
47 * @since arkts {'1.1':'11','1.2':'20'}
48 * @arkts 1.1&1.2
49 */
50declare namespace hilog {
51
52  /**
53   * Outputs debug-level logs.
54   *
55   * @param { number } domain Indicates the service domain, which is a hexadecimal integer ranging from 0x0 to 0xFFFF
56   *                          if the value exceeds the range, logs cannot be printed.
57   * @param { string } tag Identifies the log tag, length cannot exceed 32 bytes, the excess part will be truncated.
58   * @param { string } format Indicates the log format string.
59   * @param { any[] }args Indicates the log parameters.
60   * @syscap SystemCapability.HiviewDFX.HiLog
61   * @since 7
62   */
63  /**
64   * Outputs debug-level logs.
65   *
66   * @param { number } domain Indicates the service domain, which is a hexadecimal integer ranging from 0x0 to 0xFFFF
67   *                          if the value exceeds the range, logs cannot be printed.
68   * @param { string } tag Identifies the log tag, length cannot exceed 32 bytes, the excess part will be truncated.
69   * @param { string } format Indicates the log format string.
70   * @param { any[] }args Indicates the log parameters.
71   * @syscap SystemCapability.HiviewDFX.HiLog
72   * @crossplatform
73   * @since 10
74   */
75  /**
76   * Outputs debug-level logs.
77   *
78   * @param { number } domain Indicates the service domain, which is a hexadecimal integer ranging from 0x0 to 0xFFFF
79   *                          if the value exceeds the range, logs cannot be printed.
80   * @param { string } tag Identifies the log tag, length cannot exceed 32 bytes, the excess part will be truncated.
81   * @param { string } format Indicates the log format string.
82   * @param { any[] }args Indicates the log parameters.
83   * @syscap SystemCapability.HiviewDFX.HiLog
84   * @crossplatform
85   * @atomicservice
86   * @since 11
87   */
88  function debug(domain: number, tag: string, format: string, ...args: any[]): void;
89
90  /**
91   * Outputs debug-level logs.
92   *
93   * @param { number } domain Indicates the service domain, which is a hexadecimal integer ranging from 0x0 to 0xFFFF
94   *                          if the value exceeds the range, logs cannot be printed.
95   * @param { string } tag Identifies the log tag, length cannot exceed 32 bytes, the excess part will be truncated.
96   * @param { string } format Indicates the log format string.
97   * @param { RecordData[] }args Indicates the log parameters.
98   * @syscap SystemCapability.HiviewDFX.HiLog
99   * @crossplatform
100   * @atomicservice
101   * @since 20
102   * @arkts 1.2
103   */
104  function debug(domain: number, tag: string, format: string, ...args: RecordData[]): void;
105
106  /**
107   * Outputs info-level logs.
108   *
109   * @param { number } domain Indicates the service domain, which is a hexadecimal integer ranging from 0x0 to 0xFFFF
110   *                          if the value exceeds the range, logs cannot be printed.
111   * @param { string } tag Identifies the log tag, length cannot exceed 32 bytes, the excess part will be truncated.
112   * @param { string } format Indicates the log format string.
113   * @param { any[] }args Indicates the log parameters.
114   * @syscap SystemCapability.HiviewDFX.HiLog
115   * @since 7
116   */
117  /**
118   * Outputs info-level logs.
119   *
120   * @param { number } domain Indicates the service domain, which is a hexadecimal integer ranging from 0x0 to 0xFFFF
121   *                          if the value exceeds the range, logs cannot be printed.
122   * @param { string } tag Identifies the log tag, length cannot exceed 32 bytes, the excess part will be truncated.
123   * @param { string } format Indicates the log format string.
124   * @param { any[] }args Indicates the log parameters.
125   * @syscap SystemCapability.HiviewDFX.HiLog
126   * @crossplatform
127   * @since 10
128   */
129  /**
130   * Outputs info-level logs.
131   *
132   * @param { number } domain Indicates the service domain, which is a hexadecimal integer ranging from 0x0 to 0xFFFF
133   *                          if the value exceeds the range, logs cannot be printed.
134   * @param { string } tag Identifies the log tag, length cannot exceed 32 bytes, the excess part will be truncated.
135   * @param { string } format Indicates the log format string.
136   * @param { any[] }args Indicates the log parameters.
137   * @syscap SystemCapability.HiviewDFX.HiLog
138   * @crossplatform
139   * @atomicservice
140   * @since 11
141   */
142  function info(domain: number, tag: string, format: string, ...args: any[]): void;
143
144  /**
145   * Outputs info-level logs.
146   *
147   * @param { number } domain Indicates the service domain, which is a hexadecimal integer ranging from 0x0 to 0xFFFF
148   *                          if the value exceeds the range, logs cannot be printed.
149   * @param { string } tag Identifies the log tag, length cannot exceed 32 bytes, the excess part will be truncated.
150   * @param { string } format Indicates the log format string.
151   * @param { RecordData[] }args Indicates the log parameters.
152   * @syscap SystemCapability.HiviewDFX.HiLog
153   * @crossplatform
154   * @atomicservice
155   * @since 20
156   * @arkts 1.2
157   */
158  function info(domain: number, tag: string, format: string, ...args: RecordData[]): void;
159
160  /**
161   * Outputs warning-level logs.
162   *
163   * @param { number } domain Indicates the service domain, which is a hexadecimal integer ranging from 0x0 to 0xFFFF
164   *                          if the value exceeds the range, logs cannot be printed.
165   * @param { string } tag Identifies the log tag, length cannot exceed 32 bytes, the excess part will be truncated.
166   * @param { string } format Indicates the log format string.
167   * @param { any[] }args Indicates the log parameters.
168   * @syscap SystemCapability.HiviewDFX.HiLog
169   * @since 7
170   */
171  /**
172   * Outputs warning-level logs.
173   *
174   * @param { number } domain Indicates the service domain, which is a hexadecimal integer ranging from 0x0 to 0xFFFF
175   *                          if the value exceeds the range, logs cannot be printed.
176   * @param { string } tag Identifies the log tag, length cannot exceed 32 bytes, the excess part will be truncated.
177   * @param { string } format Indicates the log format string.
178   * @param { any[] }args Indicates the log parameters.
179   * @syscap SystemCapability.HiviewDFX.HiLog
180   * @crossplatform
181   * @since 10
182   */
183  /**
184   * Outputs warning-level logs.
185   *
186   * @param { number } domain Indicates the service domain, which is a hexadecimal integer ranging from 0x0 to 0xFFFF
187   *                          if the value exceeds the range, logs cannot be printed.
188   * @param { string } tag Identifies the log tag, length cannot exceed 32 bytes, the excess part will be truncated.
189   * @param { string } format Indicates the log format string.
190   * @param { any[] }args Indicates the log parameters.
191   * @syscap SystemCapability.HiviewDFX.HiLog
192   * @crossplatform
193   * @atomicservice
194   * @since 11
195   */
196  function warn(domain: number, tag: string, format: string, ...args: any[]): void;
197
198  /**
199   * Outputs warning-level logs.
200   *
201   * @param { number } domain Indicates the service domain, which is a hexadecimal integer ranging from 0x0 to 0xFFFF
202   *                          if the value exceeds the range, logs cannot be printed.
203   * @param { string } tag Identifies the log tag, length cannot exceed 32 bytes, the excess part will be truncated.
204   * @param { string } format Indicates the log format string.
205   * @param { RecordData[] }args Indicates the log parameters.
206   * @syscap SystemCapability.HiviewDFX.HiLog
207   * @crossplatform
208   * @atomicservice
209   * @since 20
210   * @arkts 1.2
211   */
212  function warn(domain: number, tag: string, format: string, ...args: RecordData[]): void;
213
214  /**
215   * Outputs error-level logs.
216   *
217   * @param { number } domain Indicates the service domain, which is a hexadecimal integer ranging from 0x0 to 0xFFFF
218   *                          if the value exceeds the range, logs cannot be printed.
219   * @param { string } tag Identifies the log tag, length cannot exceed 32 bytes, the excess part will be truncated.
220   * @param { string } format Indicates the log format string.
221   * @param { any[] }args Indicates the log parameters.
222   * @syscap SystemCapability.HiviewDFX.HiLog
223   * @since 7
224   */
225  /**
226   * Outputs error-level logs.
227   *
228   * @param { number } domain Indicates the service domain, which is a hexadecimal integer ranging from 0x0 to 0xFFFF
229   *                          if the value exceeds the range, logs cannot be printed.
230   * @param { string } tag Identifies the log tag, length cannot exceed 32 bytes, the excess part will be truncated.
231   * @param { string } format Indicates the log format string.
232   * @param { any[] }args Indicates the log parameters.
233   * @syscap SystemCapability.HiviewDFX.HiLog
234   * @crossplatform
235   * @since 10
236   */
237  /**
238   * Outputs error-level logs.
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 { string } format Indicates the log format string.
244   * @param { any[] }args Indicates the log parameters.
245   * @syscap SystemCapability.HiviewDFX.HiLog
246   * @crossplatform
247   * @atomicservice
248   * @since 11
249   */
250  function error(domain: number, tag: string, format: string, ...args: any[]): void;
251
252  /**
253   * Outputs error-level logs.
254   *
255   * @param { number } domain Indicates the service domain, which is a hexadecimal integer ranging from 0x0 to 0xFFFF
256   *                          if the value exceeds the range, logs cannot be printed.
257   * @param { string } tag Identifies the log tag, length cannot exceed 32 bytes, the excess part will be truncated.
258   * @param { string } format Indicates the log format string.
259   * @param { RecordData[] }args Indicates the log parameters.
260   * @syscap SystemCapability.HiviewDFX.HiLog
261   * @crossplatform
262   * @atomicservice
263   * @since 20
264   * @arkts 1.2
265   */
266  function error(domain: number, tag: string, format: string, ...args: RecordData[]): void;
267
268  /**
269   * Outputs fatal-level logs.
270   *
271   * @param { number } domain Indicates the service domain, which is a hexadecimal integer ranging from 0x0 to 0xFFFF
272   *                          if the value exceeds the range, logs cannot be printed.
273   * @param { string } tag Identifies the log tag, length cannot exceed 32 bytes, the excess part will be truncated.
274   * @param { string } format Indicates the log format string.
275   * @param { any[] }args Indicates the log parameters.
276   * @syscap SystemCapability.HiviewDFX.HiLog
277   * @since 7
278   */
279  /**
280   * Outputs fatal-level logs.
281   *
282   * @param { number } domain Indicates the service domain, which is a hexadecimal integer ranging from 0x0 to 0xFFFF
283   *                          if the value exceeds the range, logs cannot be printed.
284   * @param { string } tag Identifies the log tag, length cannot exceed 32 bytes, the excess part will be truncated.
285   * @param { string } format Indicates the log format string.
286   * @param { any[] }args Indicates the log parameters.
287   * @syscap SystemCapability.HiviewDFX.HiLog
288   * @crossplatform
289   * @since 10
290   */
291  /**
292   * Outputs fatal-level logs.
293   *
294   * @param { number } domain Indicates the service domain, which is a hexadecimal integer ranging from 0x0 to 0xFFFF
295   *                          if the value exceeds the range, logs cannot be printed.
296   * @param { string } tag Identifies the log tag, length cannot exceed 32 bytes, the excess part will be truncated.
297   * @param { string } format Indicates the log format string.
298   * @param { any[] }args Indicates the log parameters.
299   * @syscap SystemCapability.HiviewDFX.HiLog
300   * @crossplatform
301   * @atomicservice
302   * @since 11
303   */
304  function fatal(domain: number, tag: string, format: string, ...args: any[]): void;
305
306  /**
307   * Outputs fatal-level logs.
308   *
309   * @param { number } domain Indicates the service domain, which is a hexadecimal integer ranging from 0x0 to 0xFFFF
310   *                          if the value exceeds the range, logs cannot be printed.
311   * @param { string } tag Identifies the log tag, length cannot exceed 32 bytes, the excess part will be truncated.
312   * @param { string } format Indicates the log format string.
313   * @param { RecordData[] }args Indicates the log parameters.
314   * @syscap SystemCapability.HiviewDFX.HiLog
315   * @crossplatform
316   * @atomicservice
317   * @since 20
318   * @arkts 1.2
319   */
320  function fatal(domain: number, tag: string, format: string, ...args: RecordData[]): void;
321
322  /**
323   * Checks whether logs of the specified tag, and level can be printed.
324   *
325   * @param { number } domain Indicates the service domain, which is a hexadecimal integer ranging from 0x0 to 0xFFFF
326   *                          if the value exceeds the range, logs cannot be printed.
327   * @param { string } tag Identifies the log tag, length cannot exceed 32 bytes, the excess part will be truncated.
328   * @param { LogLevel } level log level
329   * @returns { boolean }
330   * @syscap SystemCapability.HiviewDFX.HiLog
331   * @since 7
332   */
333  /**
334   * Checks whether logs of the specified tag, and level can be printed.
335   *
336   * @param { number } domain Indicates the service domain, which is a hexadecimal integer ranging from 0x0 to 0xFFFF
337   *                          if the value exceeds the range, logs cannot be printed.
338   * @param { string } tag Identifies the log tag, length cannot exceed 32 bytes, the excess part will be truncated.
339   * @param { LogLevel } level log level
340   * @returns { boolean }
341   * @syscap SystemCapability.HiviewDFX.HiLog
342   * @atomicservice
343   * @since arkts {'1.1':'11','1.2':'20'}
344   * @arkts 1.1&1.2
345   */
346  function isLoggable(domain: number, tag: string, level: LogLevel): boolean;
347
348  /**
349   * Sets the lowest log level of the current application process.
350   *
351   * @param { LogLevel } level log level
352   * @syscap SystemCapability.HiviewDFX.HiLog
353   * @atomicservice
354   * @since arkts {'1.1':'15','1.2':'20'}
355   * @arkts 1.1&1.2
356   */
357   function setMinLogLevel(level: LogLevel): void;
358
359  /**
360   * Log level define
361   *
362   * @syscap SystemCapability.HiviewDFX.HiLog
363   * @since 7
364   */
365  /**
366   * Log level define
367   *
368   * @enum { number }
369   * @syscap SystemCapability.HiviewDFX.HiLog
370   * @crossplatform
371   * @since 10
372   */
373  /**
374   * Log level define
375   *
376   * @enum { number }
377   * @syscap SystemCapability.HiviewDFX.HiLog
378   * @crossplatform
379   * @atomicservice
380   * @since arkts {'1.1':'11','1.2':'20'}
381   * @arkts 1.1&1.2
382   */
383  enum LogLevel {
384    /**
385     * DEBUG Log level define
386     *
387     * @syscap SystemCapability.HiviewDFX.HiLog
388     * @since 7
389     */
390    /**
391     * DEBUG Log level define
392     *
393     * @syscap SystemCapability.HiviewDFX.HiLog
394     * @crossplatform
395     * @since 10
396     */
397    /**
398     * DEBUG Log level define
399     *
400     * @syscap SystemCapability.HiviewDFX.HiLog
401     * @crossplatform
402     * @atomicservice
403     * @since arkts {'1.1':'11','1.2':'20'}
404     * @arkts 1.1&1.2
405     */
406    DEBUG = 3,
407    /**
408     * INFO Log level define
409     *
410     * @syscap SystemCapability.HiviewDFX.HiLog
411     * @since 7
412     */
413    /**
414     * INFO Log level define
415     *
416     * @syscap SystemCapability.HiviewDFX.HiLog
417     * @crossplatform
418     * @since 10
419     */
420    /**
421     * INFO Log level define
422     *
423     * @syscap SystemCapability.HiviewDFX.HiLog
424     * @crossplatform
425     * @atomicservice
426     * @since arkts {'1.1':'11','1.2':'20'}
427     * @arkts 1.1&1.2
428     */
429    INFO = 4,
430    /**
431     * WARN Log level define
432     *
433     * @syscap SystemCapability.HiviewDFX.HiLog
434     * @since 7
435     */
436    /**
437     * WARN Log level define
438     *
439     * @syscap SystemCapability.HiviewDFX.HiLog
440     * @crossplatform
441     * @since 10
442     */
443    /**
444     * WARN Log level define
445     *
446     * @syscap SystemCapability.HiviewDFX.HiLog
447     * @crossplatform
448     * @atomicservice
449     * @since arkts {'1.1':'11','1.2':'20'}
450     * @arkts 1.1&1.2
451     */
452    WARN = 5,
453    /**
454     * ERROR Log level define
455     *
456     * @syscap SystemCapability.HiviewDFX.HiLog
457     * @since 7
458     */
459    /**
460     * ERROR Log level define
461     *
462     * @syscap SystemCapability.HiviewDFX.HiLog
463     * @crossplatform
464     * @since 10
465     */
466    /**
467     * ERROR Log level define
468     *
469     * @syscap SystemCapability.HiviewDFX.HiLog
470     * @crossplatform
471     * @atomicservice
472     * @since arkts {'1.1':'11','1.2':'20'}
473     * @arkts 1.1&1.2
474     */
475    ERROR = 6,
476    /**
477     * FATAL Log level define
478     *
479     * @syscap SystemCapability.HiviewDFX.HiLog
480     * @since 7
481     */
482    /**
483     * FATAL Log level define
484     *
485     * @syscap SystemCapability.HiviewDFX.HiLog
486     * @crossplatform
487     * @since 10
488     */
489    /**
490     * FATAL Log level define
491     *
492     * @syscap SystemCapability.HiviewDFX.HiLog
493     * @crossplatform
494     * @atomicservice
495     * @since arkts {'1.1':'11','1.2':'20'}
496     * @arkts 1.1&1.2
497     */
498    FATAL = 7
499  }
500}
501
502export default hilog;