Provides system event logging APIs for system HAP applications.
> **NOTE**<br>
> - The initial APIs of this module are supported since API version 9. Newly added APIs will be marked with a superscript to indicate their earliest API version.
> - The APIs of this module are system APIs and cannot be called by third-party applications.
| info | [SysEventInfo](#syseventinfo) | Yes| System event information.|
| callback | AsyncCallback<void> | Yes| Callback used to process the received return value.<br>- Value **0**: The event verification is successful, and the event will be written to the event file asynchronously. <br>- A value greater than **0**: Invalid parameters are present in the event, and the event will be written to the event file asynchronously after the invalid parameters are ignored.<br>- A value smaller than **0**: The event parameter verification fails, and the event will not be written to the event file.|
**Example**
```js
importhiSysEventfrom'@ohos.hiSysEvent';
hiSysEvent.write({
domain:"RELIABILITY",
name:"STACK",
eventType:hiSysEvent.EventType.FAULT,
params:{
PID:487,
UID:103,
PACKAGE_NAME:"com.ohos.hisysevent.test",
PROCESS_NAME:"syseventservice",
MSG:"no msg."
}
},(err,val)=>{
// do something here.
})
```
## hiSysEvent.write
write(info: SysEventInfo): Promise<void>
Writes event information to the event file. This API uses a promise to return the result.
| Promise<void> | Promise used to return the result. Depending on whether event writing is successful, you can use the **then()** or **catch()** method to process the callback.|
| number | Result of removing the watcher.<br>- **0**: Removing the watcher is successful.<br>- A value smaller than **0**: Removing the watcher has failed.|