• 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* Provides interfaces to generate system logs.
18*
19* @namespace hilog
20* @syscap SystemCapability.HiviewDFX.HiLog
21* @since 7
22*/
23
24/**
25* Provides interfaces to generate system logs.
26*
27* @namespace hilog
28* @syscap SystemCapability.HiviewDFX.HiLog
29* @crossplatform
30* @since 10
31*/
32declare namespace hilog {
33
34  /**
35   * Outputs debug-level logs.
36   *
37   * @param { number } domain Indicates the service domain, which is a hexadecimal integer ranging from 0x0 to 0xFFFF
38   * @param { string } tag Identifies the log tag, length cannot exceed 32 bytes.
39   * @param { string } format Indicates the log format string.
40   * @param { any[] }args Indicates the log parameters.
41   * @syscap SystemCapability.HiviewDFX.HiLog
42   * @since 7
43   */
44
45  /**
46   * Outputs debug-level logs.
47   *
48   * @param { number } domain Indicates the service domain, which is a hexadecimal integer ranging from 0x0 to 0xFFFF
49   * @param { string } tag Identifies the log tag, length cannot exceed 32 bytes.
50   * @param { string } format Indicates the log format string.
51   * @param { any[] }args Indicates the log parameters.
52   * @syscap SystemCapability.HiviewDFX.HiLog
53   * @crossplatform
54   * @since 10
55   */
56  function debug(domain: number, tag: string, format: string, ...args: any[]): void;
57
58  /**
59   * Outputs info-level logs.
60   *
61   * @param { number } domain Indicates the service domain, which is a hexadecimal integer ranging from 0x0 to 0xFFFF
62   * @param { string } tag Identifies the log tag, length cannot exceed 32 bytes.
63   * @param { string } format Indicates the log format string.
64   * @param { any[] }args Indicates the log parameters.
65   * @syscap SystemCapability.HiviewDFX.HiLog
66   * @since 7
67   */
68
69  /**
70   * Outputs info-level logs.
71   *
72   * @param { number } domain Indicates the service domain, which is a hexadecimal integer ranging from 0x0 to 0xFFFF
73   * @param { string } tag Identifies the log tag, length cannot exceed 32 bytes.
74   * @param { string } format Indicates the log format string.
75   * @param { any[] }args Indicates the log parameters.
76   * @syscap SystemCapability.HiviewDFX.HiLog
77   * @crossplatform
78   * @since 10
79   */
80  function info(domain: number, tag: string, format: string, ...args: any[]): void;
81
82  /**
83   * Outputs warning-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  /**
94   * Outputs warning-level logs.
95   *
96   * @param { number } domain Indicates the service domain, which is a hexadecimal integer ranging from 0x0 to 0xFFFF
97   * @param { string } tag Identifies the log tag, length cannot exceed 32 bytes.
98   * @param { string } format Indicates the log format string.
99   * @param { any[] }args Indicates the log parameters.
100   * @syscap SystemCapability.HiviewDFX.HiLog
101   * @crossplatform
102   * @since 10
103   */
104  function warn(domain: number, tag: string, format: string, ...args: any[]): void;
105
106  /**
107   * Outputs error-level logs.
108   *
109   * @param { number } domain Indicates the service domain, which is a hexadecimal integer ranging from 0x0 to 0xFFFF
110   * @param { string } tag Identifies the log tag, length cannot exceed 32 bytes.
111   * @param { string } format Indicates the log format string.
112   * @param { any[] }args Indicates the log parameters.
113   * @syscap SystemCapability.HiviewDFX.HiLog
114   * @since 7
115   */
116
117  /**
118   * Outputs error-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   * @crossplatform
126   * @since 10
127   */
128  function error(domain: number, tag: string, format: string, ...args: any[]): void;
129
130  /**
131   * Outputs fatal-level logs.
132   *
133   * @param { number } domain Indicates the service domain, which is a hexadecimal integer ranging from 0x0 to 0xFFFF
134   * @param { string } tag Identifies the log tag, length cannot exceed 32 bytes.
135   * @param { string } format Indicates the log format string.
136   * @param { any[] }args Indicates the log parameters.
137   * @syscap SystemCapability.HiviewDFX.HiLog
138   * @since 7
139   */
140
141  /**
142   * Outputs fatal-level logs.
143   *
144   * @param { number } domain Indicates the service domain, which is a hexadecimal integer ranging from 0x0 to 0xFFFF
145   * @param { string } tag Identifies the log tag, length cannot exceed 32 bytes.
146   * @param { string } format Indicates the log format string.
147   * @param { any[] }args Indicates the log parameters.
148   * @syscap SystemCapability.HiviewDFX.HiLog
149   * @crossplatform
150   * @since 10
151   */
152  function fatal(domain: number, tag: string, format: string, ...args: any[]): void;
153
154  /**
155   * Checks whether logs of the specified tag, and level can be printed.
156   *
157   * @param { number } domain Indicates the service domain, which is a hexadecimal integer ranging from 0x0 to 0xFFFF
158   * @param { string } tag Identifies the log tag, length cannot exceed 32 bytes.
159   * @param { LogLevel } level log level
160   * @returns { boolean }
161   * @syscap SystemCapability.HiviewDFX.HiLog
162   * @since 7
163   */
164  function isLoggable(domain: number, tag: string, level: LogLevel): boolean;
165
166  /**
167   * Log level define
168   *
169   * @syscap SystemCapability.HiviewDFX.HiLog
170   * @since 7
171   */
172
173  /**
174   * Log level define
175   *
176   * @enum { number }
177   * @syscap SystemCapability.HiviewDFX.HiLog
178   * @crossplatform
179   * @since 10
180   */
181  enum LogLevel {
182    /**
183     * DEBUG Log level define
184     *
185     * @syscap SystemCapability.HiviewDFX.HiLog
186     * @since 7
187     */
188    /**
189     * DEBUG Log level define
190     *
191     * @syscap SystemCapability.HiviewDFX.HiLog
192     * @crossplatform
193     * @since 10
194     */
195    DEBUG = 3,
196    /**
197     * INFO Log level define
198     *
199     * @syscap SystemCapability.HiviewDFX.HiLog
200     * @since 7
201     */
202    /**
203     * INFO Log level define
204     *
205     * @syscap SystemCapability.HiviewDFX.HiLog
206     * @crossplatform
207     * @since 10
208     */
209    INFO = 4,
210    /**
211     * WARN Log level define
212     *
213     * @syscap SystemCapability.HiviewDFX.HiLog
214     * @since 7
215     */
216    /**
217     * WARN Log level define
218     *
219     * @syscap SystemCapability.HiviewDFX.HiLog
220     * @crossplatform
221     * @since 10
222     */
223    WARN = 5,
224    /**
225     * ERROR Log level define
226     *
227     * @syscap SystemCapability.HiviewDFX.HiLog
228     * @since 7
229     */
230    /**
231     * ERROR Log level define
232     *
233     * @syscap SystemCapability.HiviewDFX.HiLog
234     * @crossplatform
235     * @since 10
236     */
237    ERROR = 6,
238    /**
239     * FATAL Log level define
240     *
241     * @syscap SystemCapability.HiviewDFX.HiLog
242     * @since 7
243     */
244    /**
245     * FATAL Log level define
246     *
247     * @syscap SystemCapability.HiviewDFX.HiLog
248     * @crossplatform
249     * @since 10
250     */
251    FATAL = 7
252  }
253}
254
255export default hilog;