2021-08-30 09:10:11 +00:00
|
|
|
/*
|
2023-05-29 03:16:48 +00:00
|
|
|
* Copyright (c) 2021-2023 Huawei Device Co., Ltd.
|
2021-08-30 09:22:27 +00:00
|
|
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
|
|
* you may not use this file except in compliance with the License.
|
|
|
|
* You may obtain a copy of the License at
|
|
|
|
*
|
|
|
|
* http://www.apache.org/licenses/LICENSE-2.0
|
|
|
|
*
|
|
|
|
* Unless required by applicable law or agreed to in writing, software
|
|
|
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
|
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
|
|
* See the License for the specific language governing permissions and
|
|
|
|
* limitations under the License.
|
|
|
|
*/
|
2021-08-30 09:10:11 +00:00
|
|
|
|
2023-12-11 09:08:03 +00:00
|
|
|
/**
|
|
|
|
* @file
|
2024-01-12 09:19:18 +00:00
|
|
|
* @kit PerformanceAnalysisKit
|
2023-12-11 09:08:03 +00:00
|
|
|
*/
|
|
|
|
|
2023-07-13 12:32:36 +00:00
|
|
|
import type { AsyncCallback } from './@ohos.base';
|
2021-08-30 09:10:11 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Provides the event logging function for applications to log the fault, statistical, security,
|
|
|
|
* and user behavior events reported during running. Based on event information,
|
|
|
|
* you will be able to analyze the running status of applications.
|
|
|
|
*
|
2023-05-29 03:16:48 +00:00
|
|
|
* @namespace hiAppEvent
|
2022-02-08 06:39:27 +00:00
|
|
|
* @syscap SystemCapability.HiviewDFX.HiAppEvent
|
2023-05-29 03:16:48 +00:00
|
|
|
* @since 7
|
2022-10-10 14:08:21 +00:00
|
|
|
* @deprecated since 9
|
|
|
|
* @useinstead ohos.hiviewdfx.hiAppEvent
|
2021-08-30 09:10:11 +00:00
|
|
|
*/
|
|
|
|
declare namespace hiAppEvent {
|
2023-04-21 09:47:24 +00:00
|
|
|
/**
|
|
|
|
* Enumerate application event types.
|
|
|
|
*
|
2023-05-29 03:16:48 +00:00
|
|
|
* @enum { number }
|
2023-04-21 09:47:24 +00:00
|
|
|
* @syscap SystemCapability.HiviewDFX.HiAppEvent
|
2023-05-29 03:16:48 +00:00
|
|
|
* @since 7
|
|
|
|
* @deprecated since 9
|
2023-04-21 09:47:24 +00:00
|
|
|
*/
|
|
|
|
enum EventType {
|
2021-08-30 09:10:11 +00:00
|
|
|
/**
|
2023-04-21 09:47:24 +00:00
|
|
|
* Fault event.
|
2022-02-08 06:39:27 +00:00
|
|
|
*
|
2022-02-08 06:44:09 +00:00
|
|
|
* @syscap SystemCapability.HiviewDFX.HiAppEvent
|
2023-05-29 03:16:48 +00:00
|
|
|
* @since 7
|
|
|
|
* @deprecated since 9
|
2021-08-30 09:10:11 +00:00
|
|
|
*/
|
2023-04-21 09:47:24 +00:00
|
|
|
FAULT = 1,
|
2021-08-30 09:10:11 +00:00
|
|
|
|
|
|
|
/**
|
2023-04-21 09:47:24 +00:00
|
|
|
* Statistic event.
|
2022-02-08 06:39:27 +00:00
|
|
|
*
|
|
|
|
* @syscap SystemCapability.HiviewDFX.HiAppEvent
|
2023-05-29 03:16:48 +00:00
|
|
|
* @since 7
|
|
|
|
* @deprecated since 9
|
2021-08-30 09:10:11 +00:00
|
|
|
*/
|
2023-04-21 09:47:24 +00:00
|
|
|
STATISTIC = 2,
|
2021-08-30 09:10:11 +00:00
|
|
|
|
|
|
|
/**
|
2023-04-21 09:47:24 +00:00
|
|
|
* Security event.
|
2022-02-08 06:39:27 +00:00
|
|
|
*
|
|
|
|
* @syscap SystemCapability.HiviewDFX.HiAppEvent
|
2023-05-29 03:16:48 +00:00
|
|
|
* @since 7
|
|
|
|
* @deprecated since 9
|
2021-08-30 09:10:11 +00:00
|
|
|
*/
|
2023-04-21 09:47:24 +00:00
|
|
|
SECURITY = 3,
|
2021-08-30 09:10:11 +00:00
|
|
|
|
|
|
|
/**
|
2023-04-21 09:47:24 +00:00
|
|
|
* User behavior event.
|
2021-08-30 09:10:11 +00:00
|
|
|
*
|
2022-02-08 06:39:27 +00:00
|
|
|
* @syscap SystemCapability.HiviewDFX.HiAppEvent
|
2023-05-29 03:16:48 +00:00
|
|
|
* @since 7
|
|
|
|
* @deprecated since 9
|
2021-08-30 09:10:11 +00:00
|
|
|
*/
|
2023-04-21 09:47:24 +00:00
|
|
|
BEHAVIOR = 4
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Preset event.
|
|
|
|
*
|
2023-05-29 03:16:48 +00:00
|
|
|
* @namespace Event
|
2023-04-21 09:47:24 +00:00
|
|
|
* @syscap SystemCapability.HiviewDFX.HiAppEvent
|
2023-05-29 03:16:48 +00:00
|
|
|
* @since 7
|
|
|
|
* @deprecated since 9
|
2023-04-21 09:47:24 +00:00
|
|
|
*/
|
|
|
|
namespace Event {
|
|
|
|
/**
|
|
|
|
* User login event.
|
|
|
|
*
|
2023-05-29 03:16:48 +00:00
|
|
|
* @constant
|
2023-04-21 09:47:24 +00:00
|
|
|
* @syscap SystemCapability.HiviewDFX.HiAppEvent
|
2023-05-29 03:16:48 +00:00
|
|
|
* @since 7
|
|
|
|
* @deprecated since 9
|
2023-04-21 09:47:24 +00:00
|
|
|
*/
|
|
|
|
const USER_LOGIN: string;
|
2021-08-30 09:10:11 +00:00
|
|
|
|
|
|
|
/**
|
2023-04-21 09:47:24 +00:00
|
|
|
* User logout event.
|
|
|
|
*
|
2023-05-29 03:16:48 +00:00
|
|
|
* @constant
|
2023-04-21 09:47:24 +00:00
|
|
|
* @syscap SystemCapability.HiviewDFX.HiAppEvent
|
2023-05-29 03:16:48 +00:00
|
|
|
* @since 7
|
|
|
|
* @deprecated since 9
|
2023-04-21 09:47:24 +00:00
|
|
|
*/
|
|
|
|
const USER_LOGOUT: string;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Distributed service event.
|
|
|
|
*
|
2023-05-29 03:16:48 +00:00
|
|
|
* @constant
|
2023-04-21 09:47:24 +00:00
|
|
|
* @syscap SystemCapability.HiviewDFX.HiAppEvent
|
2023-05-29 03:16:48 +00:00
|
|
|
* @since 7
|
|
|
|
* @deprecated since 9
|
2023-04-21 09:47:24 +00:00
|
|
|
*/
|
|
|
|
const DISTRIBUTED_SERVICE_START: string;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Preset param.
|
|
|
|
*
|
2023-05-29 03:16:48 +00:00
|
|
|
* @namespace Param
|
2023-04-21 09:47:24 +00:00
|
|
|
* @syscap SystemCapability.HiviewDFX.HiAppEvent
|
2023-05-29 03:16:48 +00:00
|
|
|
* @since 7
|
|
|
|
* @deprecated since 9
|
2023-04-21 09:47:24 +00:00
|
|
|
*/
|
|
|
|
namespace Param {
|
|
|
|
/**
|
|
|
|
* User id.
|
|
|
|
*
|
2023-05-29 03:16:48 +00:00
|
|
|
* @constant
|
2023-04-21 09:47:24 +00:00
|
|
|
* @syscap SystemCapability.HiviewDFX.HiAppEvent
|
2023-05-29 03:16:48 +00:00
|
|
|
* @since 7
|
|
|
|
* @deprecated since 9
|
2023-04-21 09:47:24 +00:00
|
|
|
*/
|
|
|
|
const USER_ID: string;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Distributed service name.
|
|
|
|
*
|
2023-05-29 03:16:48 +00:00
|
|
|
* @constant
|
2023-04-21 09:47:24 +00:00
|
|
|
* @syscap SystemCapability.HiviewDFX.HiAppEvent
|
2023-05-29 03:16:48 +00:00
|
|
|
* @since 7
|
|
|
|
* @deprecated since 9
|
2023-04-21 09:47:24 +00:00
|
|
|
*/
|
|
|
|
const DISTRIBUTED_SERVICE_NAME: string;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Distributed service instance id.
|
|
|
|
*
|
2023-05-29 03:16:48 +00:00
|
|
|
* @constant
|
2023-04-21 09:47:24 +00:00
|
|
|
* @syscap SystemCapability.HiviewDFX.HiAppEvent
|
2023-05-29 03:16:48 +00:00
|
|
|
* @since 7
|
|
|
|
* @deprecated since 9
|
2023-04-21 09:47:24 +00:00
|
|
|
*/
|
|
|
|
const DISTRIBUTED_SERVICE_INSTANCE_ID: string;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Write application event.
|
|
|
|
*
|
2023-05-29 03:16:48 +00:00
|
|
|
* @param { string } eventName Application event name.
|
|
|
|
* @param { EventType } eventType Application event type.
|
|
|
|
* @param { object } keyValues Application event key-value pair params.
|
|
|
|
* @returns { Promise<void> } Return Promise.
|
2023-04-21 09:47:24 +00:00
|
|
|
* @static
|
2023-05-29 03:16:48 +00:00
|
|
|
* @syscap SystemCapability.HiviewDFX.HiAppEvent
|
|
|
|
* @since 7
|
|
|
|
* @deprecated since 9
|
2023-04-21 09:47:24 +00:00
|
|
|
*/
|
|
|
|
function write(eventName: string, eventType: EventType, keyValues: object): Promise<void>;
|
2023-05-29 03:16:48 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Write application event.
|
|
|
|
*
|
|
|
|
* @param { string } eventName Application event name.
|
|
|
|
* @param { EventType } eventType Application event type.
|
|
|
|
* @param { object } keyValues Application event key-value pair params.
|
|
|
|
* @param { AsyncCallback<void> } [callback] Callback function.
|
|
|
|
* @static
|
|
|
|
* @syscap SystemCapability.HiviewDFX.HiAppEvent
|
|
|
|
* @since 7
|
|
|
|
* @deprecated since 9
|
|
|
|
*/
|
2023-04-21 09:47:24 +00:00
|
|
|
function write(eventName: string, eventType: EventType, keyValues: object, callback: AsyncCallback<void>): void;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Application event logging configuration interface.
|
|
|
|
*
|
2023-05-29 03:16:48 +00:00
|
|
|
* @param { ConfigOption } config Application event logging configuration item object.
|
|
|
|
* @returns { boolean } Configuration result.
|
2023-04-21 09:47:24 +00:00
|
|
|
* @static
|
2023-05-29 03:16:48 +00:00
|
|
|
* @syscap SystemCapability.HiviewDFX.HiAppEvent
|
|
|
|
* @since 7
|
|
|
|
* @deprecated since 9
|
2023-04-21 09:47:24 +00:00
|
|
|
*/
|
|
|
|
function configure(config: ConfigOption): boolean;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Describe the options for the configuration.
|
|
|
|
*
|
2023-05-29 03:16:48 +00:00
|
|
|
* @interface ConfigOption
|
2023-04-21 09:47:24 +00:00
|
|
|
* @syscap SystemCapability.HiviewDFX.HiAppEvent
|
2023-05-29 03:16:48 +00:00
|
|
|
* @since 7
|
|
|
|
* @deprecated since 9
|
2023-04-21 09:47:24 +00:00
|
|
|
*/
|
|
|
|
interface ConfigOption {
|
|
|
|
/**
|
|
|
|
* Configuration item: application event logging switch.
|
2021-08-30 09:10:11 +00:00
|
|
|
*
|
2024-07-13 03:48:29 +00:00
|
|
|
* @type { ?boolean }
|
2022-02-08 06:39:27 +00:00
|
|
|
* @syscap SystemCapability.HiviewDFX.HiAppEvent
|
2023-05-29 03:16:48 +00:00
|
|
|
* @since 7
|
|
|
|
* @deprecated since 9
|
2021-08-30 09:10:11 +00:00
|
|
|
*/
|
2023-04-21 09:47:24 +00:00
|
|
|
disable?: boolean;
|
2021-08-30 09:10:11 +00:00
|
|
|
|
2022-02-08 06:39:27 +00:00
|
|
|
/**
|
2023-04-21 09:47:24 +00:00
|
|
|
* Configuration item: event file directory storage quota size.
|
2022-02-08 06:39:27 +00:00
|
|
|
*
|
2024-07-13 03:48:29 +00:00
|
|
|
* @type { ?string }
|
2022-02-08 06:39:27 +00:00
|
|
|
* @syscap SystemCapability.HiviewDFX.HiAppEvent
|
2023-05-29 03:16:48 +00:00
|
|
|
* @since 7
|
|
|
|
* @deprecated since 9
|
2022-02-08 06:39:27 +00:00
|
|
|
*/
|
2023-04-21 09:47:24 +00:00
|
|
|
maxStorage?: string;
|
|
|
|
}
|
2021-08-30 09:10:11 +00:00
|
|
|
}
|
|
|
|
|
2022-11-24 02:46:59 +00:00
|
|
|
export default hiAppEvent;
|