• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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     BaseContext() {};
~BaseContext()30     virtual ~BaseContext() {};
31     napi_async_work work = nullptr;
32     napi_deferred deferred = nullptr;
33     napi_ref callbackRef = nullptr;
34 };
35 
36 struct FaultLogNapiInfo {
37     int pid = 0;
38     int uid = 0;
39     int type = 0;
40     int64_t ts = 0;
41     std::string reason = "";
42     std::string module = "";
43     std::string summary = "";
44     std::string fullLog = "";
45 };
46 
47 class FaultLogInfoContext : public BaseContext {
48 public:
FaultLogInfoContext()49     FaultLogInfoContext() {};
~FaultLogInfoContext()50     ~FaultLogInfoContext() {};
51     int32_t faultType = 0;
52     bool resolved = false;
53     std::vector<FaultLogNapiInfo> infoVector;
54 };
55 }  // namespace HiviewDFX
56 }  // namespace OHOS
57 #endif  // FAULTLOGGER_JS_NAPI_QUERY_LOG_H