Development Guidelines on HiSysEvent
Overview
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.
Available APIs
The following table lists the C++ APIs provided by the HiSysEvent class.
For details about the HiSysEvent class, see the API reference.
Table 1 C++ APIs provided by HiSysEvent
Table 2 Description of HiSysEvent::Domain APIs
Table 3 Description of HiSysEvent::EventType APIs
How to Develop
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::FAULT, "app_name", "com.demo");
-
Configure compilation information. Specifically, add the subsystem SDK dependency to BUILD.gn.
external_deps = [ "hisysevent_native:libhisysevent" ]