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