• 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
16import type { AsyncCallback } from './@ohos.base';
17
18/**
19 * Provides the event logging function for applications to log the fault, statistical, security,
20 * and user behavior events reported during running. Based on event information,
21 * you will be able to analyze the running status of applications.
22 *
23 * @namespace hiAppEvent
24 * @syscap SystemCapability.HiviewDFX.HiAppEvent
25 * @since 7
26 * @deprecated since 9
27 * @useinstead ohos.hiviewdfx.hiAppEvent
28 */
29declare namespace hiAppEvent {
30  /**
31   * Enumerate application event types.
32   *
33   * @enum { number }
34   * @syscap SystemCapability.HiviewDFX.HiAppEvent
35   * @since 7
36   * @deprecated since 9
37   */
38  enum EventType {
39    /**
40     * Fault event.
41     *
42     * @syscap SystemCapability.HiviewDFX.HiAppEvent
43     * @since 7
44     * @deprecated since 9
45     */
46    FAULT = 1,
47
48    /**
49     * Statistic event.
50     *
51     * @syscap SystemCapability.HiviewDFX.HiAppEvent
52     * @since 7
53     * @deprecated since 9
54     */
55    STATISTIC = 2,
56
57    /**
58     * Security event.
59     *
60     * @syscap SystemCapability.HiviewDFX.HiAppEvent
61     * @since 7
62     * @deprecated since 9
63     */
64    SECURITY = 3,
65
66    /**
67     * User behavior event.
68     *
69     * @syscap SystemCapability.HiviewDFX.HiAppEvent
70     * @since 7
71     * @deprecated since 9
72     */
73    BEHAVIOR = 4
74  }
75
76  /**
77   * Preset event.
78   *
79   * @namespace Event
80   * @syscap SystemCapability.HiviewDFX.HiAppEvent
81   * @since 7
82   * @deprecated since 9
83   */
84  namespace Event {
85    /**
86     * User login event.
87     *
88     * @constant
89     * @syscap SystemCapability.HiviewDFX.HiAppEvent
90     * @since 7
91     * @deprecated since 9
92     */
93    const USER_LOGIN: string;
94
95    /**
96     * User logout event.
97     *
98     * @constant
99     * @syscap SystemCapability.HiviewDFX.HiAppEvent
100     * @since 7
101     * @deprecated since 9
102     */
103    const USER_LOGOUT: string;
104
105    /**
106     * Distributed service event.
107     *
108     * @constant
109     * @syscap SystemCapability.HiviewDFX.HiAppEvent
110     * @since 7
111     * @deprecated since 9
112     */
113    const DISTRIBUTED_SERVICE_START: string;
114  }
115
116  /**
117   * Preset param.
118   *
119   * @namespace Param
120   * @syscap SystemCapability.HiviewDFX.HiAppEvent
121   * @since 7
122   * @deprecated since 9
123   */
124  namespace Param {
125    /**
126     * User id.
127     *
128     * @constant
129     * @syscap SystemCapability.HiviewDFX.HiAppEvent
130     * @since 7
131     * @deprecated since 9
132     */
133    const USER_ID: string;
134
135    /**
136     * Distributed service name.
137     *
138     * @constant
139     * @syscap SystemCapability.HiviewDFX.HiAppEvent
140     * @since 7
141     * @deprecated since 9
142     */
143    const DISTRIBUTED_SERVICE_NAME: string;
144
145    /**
146     * Distributed service instance id.
147     *
148     * @constant
149     * @syscap SystemCapability.HiviewDFX.HiAppEvent
150     * @since 7
151     * @deprecated since 9
152     */
153    const DISTRIBUTED_SERVICE_INSTANCE_ID: string;
154  }
155
156  /**
157   * Write application event.
158   *
159   * @param { string } eventName Application event name.
160   * @param { EventType } eventType Application event type.
161   * @param { object } keyValues Application event key-value pair params.
162   * @returns { Promise<void> } Return Promise.
163   * @static
164   * @syscap SystemCapability.HiviewDFX.HiAppEvent
165   * @since 7
166   * @deprecated since 9
167   */
168  function write(eventName: string, eventType: EventType, keyValues: object): Promise<void>;
169
170  /**
171   * Write application event.
172   *
173   * @param { string } eventName Application event name.
174   * @param { EventType } eventType Application event type.
175   * @param { object } keyValues Application event key-value pair params.
176   * @param { AsyncCallback<void> } [callback] Callback function.
177   * @static
178   * @syscap SystemCapability.HiviewDFX.HiAppEvent
179   * @since 7
180   * @deprecated since 9
181   */
182  function write(eventName: string, eventType: EventType, keyValues: object, callback: AsyncCallback<void>): void;
183
184  /**
185   * Application event logging configuration interface.
186   *
187   * @param { ConfigOption } config Application event logging configuration item object.
188   * @returns { boolean } Configuration result.
189   * @static
190   * @syscap SystemCapability.HiviewDFX.HiAppEvent
191   * @since 7
192   * @deprecated since 9
193   */
194  function configure(config: ConfigOption): boolean;
195
196  /**
197   * Describe the options for the configuration.
198   *
199   * @interface ConfigOption
200   * @syscap SystemCapability.HiviewDFX.HiAppEvent
201   * @since 7
202   * @deprecated since 9
203   */
204  interface ConfigOption {
205    /**
206     * Configuration item: application event logging switch.
207     *
208     * @syscap SystemCapability.HiviewDFX.HiAppEvent
209     * @since 7
210     * @deprecated since 9
211     */
212    disable?: boolean;
213
214    /**
215     * Configuration item: event file directory storage quota size.
216     *
217     * @syscap SystemCapability.HiviewDFX.HiAppEvent
218     * @since 7
219     * @deprecated since 9
220     */
221    maxStorage?: string;
222  }
223}
224
225export default hiAppEvent;
226