032502c2d8
Merge pull request !580 from 李浔/master |
||
---|---|---|
adapter/native/idl | ||
figures | ||
frameworks/native | ||
interfaces | ||
test | ||
.gitattributes | ||
.gitignore | ||
bundle.json | ||
Cargo.toml | ||
LICENSE | ||
OAT.xml | ||
README_zh.md | ||
README.md | ||
rustfmt.toml |
HiSysEvent
Introduction
HiSysEvent provides event logging APIs for OpenHarmony to record important information of key processes during system running, helping you locate faults. In addition, you can upload the log data to the cloud for big data analytics.
Figure 1 HiSysEvent architecture
Directory Structure
/base/hiviewdfx/hisysevent # HiSysEvent source code
├── adapter # Platform adaptation code
│ └── native # native adaptation code
├── frameworks # Framework code
│ └── native # C/C++ APIs
├── interfaces # External APIs
└── native # C++ APIs
└── innerkits # C++ APIs opened to internal subsystems
Description
Available APIs
The following table lists the C++ APIs provided by the HiSysEvent class.
Table 1 C++ APIs provided by HiSysEvent
Sample Code
C++
-
Develop the source code.
Include the HiSysEvent header file in the class definition header file or class implementation source file. For example:
#include "hisysevent.h"
Add the event logging code. For example, if you want to log events specific to the app start time
start\_app
, then add the following code to the service implementation source file:HiSysEvent::Write(HiSysEvent::Domain::AAFWK, "start_app", HiSysEvent::EventType::BEHAVIOR, "app_name", "com.demo");
-
Configure compilation information. Specifically, add the subsystem SDK dependency to BUILD.gn.
external_deps = [ "hisysevent:libhisysevent" ]
Repositories Involved
hiviewdfx_hisysevent