1 /* 2 * Copyright (c) 2021 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 #ifndef FAULTLOGGER_NAPI_QUERY_LOG_H 16 #define FAULTLOGGER_NAPI_QUERY_LOG_H 17 #include <string> 18 #include <vector> 19 20 #include "napi/native_api.h" 21 #include "napi/native_node_api.h" 22 23 #include "faultlogger_client.h" 24 25 namespace OHOS { 26 namespace HiviewDFX { 27 class BaseContext { 28 public: ~BaseContext()29 virtual ~BaseContext() {}; 30 napi_async_work work = nullptr; 31 napi_deferred deferred = nullptr; 32 napi_ref callbackRef = nullptr; 33 }; 34 35 struct FaultLogNapiInfo { 36 int pid = 0; 37 int uid = 0; 38 int type = 0; 39 int64_t ts = 0; 40 std::string reason = ""; 41 std::string module = ""; 42 std::string summary = ""; 43 std::string fullLog = ""; 44 }; 45 46 class FaultLogInfoContext : public BaseContext { 47 public: 48 int32_t faultType = 0; 49 bool resolved = false; 50 std::vector<FaultLogNapiInfo> infoVector; 51 }; 52 } // namespace HiviewDFX 53 } // namespace OHOS 54 #endif // FAULTLOGGER_JS_NAPI_QUERY_LOG_H