1/* 2* Copyright (C) 2021-2022 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 * This module provides the capability to query faultlog data. 25 * This module is deprecated since 18, please use hiAppEvent to monitor APP_CRASH and APP_FREEZE event 26 * @namespace FaultLogger 27 * @syscap SystemCapability.HiviewDFX.Hiview.FaultLogger 28 * @since 8 29 * @deprecated since 18 30 * @useinstead ohos.hiviewdfx.hiAppEvent 31 */ 32 33 34declare namespace FaultLogger { 35 /** 36 * The type of fault type. 37 * @enum { number } 38 * @syscap SystemCapability.HiviewDFX.Hiview.FaultLogger 39 * @since 8 40 * @deprecated since 18 41 */ 42 enum FaultType { 43 /** 44 * NO_SPECIFIC log type not distinguished. 45 * @syscap SystemCapability.HiviewDFX.Hiview.FaultLogger 46 * @since 8 47 * @deprecated since 18 48 */ 49 NO_SPECIFIC = 0, 50 /** 51 * CPP_CRASH CPP crash log type. 52 * @syscap SystemCapability.HiviewDFX.Hiview.FaultLogger 53 * @since 8 54 * @deprecated since 18 55 */ 56 CPP_CRASH = 2, 57 /** 58 * JS_CRASH JS crash log type. 59 * @syscap SystemCapability.HiviewDFX.Hiview.FaultLogger 60 * @since 8 61 * @deprecated since 18 62 */ 63 JS_CRASH = 3, 64 /** 65 * APP_FREEZE app freeze log type. 66 * @syscap SystemCapability.HiviewDFX.Hiview.FaultLogger 67 * @since 8 68 * @deprecated since 18 69 */ 70 APP_FREEZE = 4, 71 } 72 73 /** 74 * Query the result of the current application FaultLog in callback Mode. 75 * @param { FaultType } faultType - Fault type to query 76 * @param { AsyncCallback<Array<FaultLogInfo>> } callback - Faultlog information data callback function 77 * @syscap SystemCapability.HiviewDFX.Hiview.FaultLogger 78 * @since 8 79 * @deprecated since 9 80 * @useinstead ohos.faultlogger/FaultLogger#query 81 */ 82 function querySelfFaultLog(faultType: FaultType, callback: AsyncCallback<Array<FaultLogInfo>>): void; 83 84 /** 85 * Query the result of the current application FaultLog in return promise mode. 86 * @param { FaultType } faultType - Fault type to query 87 * @returns { Promise<Array<FaultLogInfo>> } return faultlog information data by promise 88 * @syscap SystemCapability.HiviewDFX.Hiview.FaultLogger 89 * @since 8 90 * @deprecated since 9 91 * @useinstead ohos.faultlogger/FaultLogger#query 92 */ 93 function querySelfFaultLog(faultType: FaultType): Promise<Array<FaultLogInfo>>; 94 95 /** 96 * Query the result of the current application FaultLog in callback Mode. 97 * @param { FaultType } faultType - Fault type to query 98 * @param { AsyncCallback<Array<FaultLogInfo>> } callback - Faultlog information data callback function 99 * @throws { BusinessError } 401 - The parameter check failed, Parameter type error 100 * @throws { BusinessError } 801 - The specified SystemCapability name was not found 101 * @throws { BusinessError } 10600001 - The service is not started or is faulty 102 * @syscap SystemCapability.HiviewDFX.Hiview.FaultLogger 103 * @since 9 104 * @deprecated since 18 105 */ 106 function query(faultType: FaultType, callback: AsyncCallback<Array<FaultLogInfo>>): void; 107 108 /** 109 * Query the result of the current application FaultLog in return promise mode. 110 * @param { FaultType } faultType - Fault type to query 111 * @returns { Promise<Array<FaultLogInfo>> } return faultlog information data by promise 112 * @throws { BusinessError } 401 - The parameter check failed, Parameter type error 113 * @throws { BusinessError } 801 - The specified SystemCapability name was not found 114 * @throws { BusinessError } 10600001 - The service is not started or is faulty 115 * @syscap SystemCapability.HiviewDFX.Hiview.FaultLogger 116 * @since 9 117 * @deprecated since 18 118 */ 119 function query(faultType: FaultType): Promise<Array<FaultLogInfo>>; 120 121 /** 122 * FaultLog information data structure. 123 * @interface FaultLogInfo 124 * @syscap SystemCapability.HiviewDFX.Hiview.FaultLogger 125 * @since 8 126 * @deprecated since 18 127 */ 128 interface FaultLogInfo { 129 /** 130 * Process id. 131 * @type { number } 132 * @syscap SystemCapability.HiviewDFX.Hiview.FaultLogger 133 * @since 8 134 * @deprecated since 18 135 */ 136 pid: number; 137 138 /** 139 * User id. 140 * @type { number } 141 * @syscap SystemCapability.HiviewDFX.Hiview.FaultLogger 142 * @since 8 143 * @deprecated since 18 144 */ 145 uid: number; 146 147 /** 148 * Fault type. 149 * @type { FaultType } 150 * @syscap SystemCapability.HiviewDFX.Hiview.FaultLogger 151 * @since 8 152 * @deprecated since 18 153 */ 154 type: FaultType; 155 156 /** 157 * Second level timestamp. 158 * @type { number } 159 * @syscap SystemCapability.HiviewDFX.Hiview.FaultLogger 160 * @since 8 161 * @deprecated since 18 162 */ 163 timestamp: number; 164 165 /** 166 * Fault reason. 167 * @type { string } 168 * @syscap SystemCapability.HiviewDFX.Hiview.FaultLogger 169 * @since 8 170 * @deprecated since 18 171 */ 172 reason: string; 173 174 /** 175 * Fault module. 176 * @type { string } 177 * @syscap SystemCapability.HiviewDFX.Hiview.FaultLogger 178 * @since 8 179 * @deprecated since 18 180 */ 181 module: string; 182 183 /** 184 * Fault summary. 185 * @type { string } 186 * @syscap SystemCapability.HiviewDFX.Hiview.FaultLogger 187 * @since 8 188 * @deprecated since 18 189 */ 190 summary: string; 191 192 /** 193 * Fault log. 194 * @type { string } 195 * @syscap SystemCapability.HiviewDFX.Hiview.FaultLogger 196 * @since 8 197 * @deprecated since 18 198 */ 199 fullLog: string; 200 } 201} 202 203export default FaultLogger; 204