You need to sign in or sign up before continuing.
未验证 提交 9cbb6274 编写于 作者: O openharmony_ci 提交者: Gitee

!3479 fix the docs of hiappevent and hilog

Merge pull request !3479 from lyj/master
...@@ -6,7 +6,7 @@ ...@@ -6,7 +6,7 @@
## Modules to Import ## Modules to Import
``` ```js
import hiAppEvent from '@ohos.hiAppEvent'; import hiAppEvent from '@ohos.hiAppEvent';
``` ```
...@@ -30,7 +30,7 @@ Writes event information to the event file of the current day. This API supports ...@@ -30,7 +30,7 @@ Writes event information to the event file of the current day. This API supports
**Example** **Example**
``` ```js
hiAppEvent.write("test_event", hiAppEvent.EventType.FAULT, {"int_data":100, "str_data":"strValue"}, (err, value) => { hiAppEvent.write("test_event", hiAppEvent.EventType.FAULT, {"int_data":100, "str_data":"strValue"}, (err, value) => {
if (err) { if (err) {
// Event writing exception: Write the event to the event file after the invalid parameters in the event are ignored, or stop writing the event if the event verification fails. // Event writing exception: Write the event to the event file after the invalid parameters in the event are ignored, or stop writing the event if the event verification fails.
...@@ -68,7 +68,7 @@ Writes event information to the event file of the current day. This API supports ...@@ -68,7 +68,7 @@ Writes event information to the event file of the current day. This API supports
**Example** **Example**
``` ```js
hiAppEvent.write("test_event", hiAppEvent.EventType.FAULT, {"int_data":100, "str_data":"strValue"}) hiAppEvent.write("test_event", hiAppEvent.EventType.FAULT, {"int_data":100, "str_data":"strValue"})
.then((value) => { .then((value) => {
// Event writing succeeded. // Event writing succeeded.
...@@ -101,7 +101,7 @@ Configures the application event logging function, such as setting the event log ...@@ -101,7 +101,7 @@ Configures the application event logging function, such as setting the event log
| boolean | Returns **true** if the configuration is successful; returns **false** otherwise.| | boolean | Returns **true** if the configuration is successful; returns **false** otherwise.|
**Example** **Example**
``` ```js
// Set the application event logging switch. // Set the application event logging switch.
hiAppEvent.configure({ hiAppEvent.configure({
disable: true disable: true
......
...@@ -6,7 +6,7 @@ ...@@ -6,7 +6,7 @@
## Modules to Import ## Modules to Import
``` ```js
import hilog from '@ohos.hilog'; import hilog from '@ohos.hilog';
``` ```
...@@ -30,7 +30,7 @@ Prints logs of the DEBUG level. ...@@ -30,7 +30,7 @@ Prints logs of the DEBUG level.
**Example** **Example**
``` ```js
hilog.debug(0xFF00, "testTag", "%d: %{private}s World %{public}f", 1, "hello", 3.0); hilog.debug(0xFF00, "testTag", "%d: %{private}s World %{public}f", 1, "hello", 3.0);
``` ```
...@@ -59,7 +59,7 @@ Prints logs of the INFO level. ...@@ -59,7 +59,7 @@ Prints logs of the INFO level.
**Example** **Example**
``` ```js
hilog.info(0xFF00, "testTag", "%d: %{private}s World %{public}f", 1, "hello", 3.0); hilog.info(0xFF00, "testTag", "%d: %{private}s World %{public}f", 1, "hello", 3.0);
``` ```
...@@ -88,7 +88,7 @@ Prints logs of the WARN level. ...@@ -88,7 +88,7 @@ Prints logs of the WARN level.
**Example** **Example**
``` ```js
hilog.warn(0xFF00, "testTag", "%d: %{private}s World %{public}f", 1, "hello", 3.0); hilog.warn(0xFF00, "testTag", "%d: %{private}s World %{public}f", 1, "hello", 3.0);
``` ```
...@@ -117,7 +117,7 @@ Prints logs of the ERROR level. ...@@ -117,7 +117,7 @@ Prints logs of the ERROR level.
**Example** **Example**
``` ```js
hilog.error(0xFF00, "testTag", "%d: %{private}s World %{public}f", 1, "hello", 3.0); hilog.error(0xFF00, "testTag", "%d: %{private}s World %{public}f", 1, "hello", 3.0);
``` ```
...@@ -146,7 +146,7 @@ Prints logs of the FATAL level. ...@@ -146,7 +146,7 @@ Prints logs of the FATAL level.
**Example** **Example**
``` ```js
hilog.fatal(0xFF00, "testTag", "%d: %{private}s World %{public}f", 1, "hello", 3.0); hilog.fatal(0xFF00, "testTag", "%d: %{private}s World %{public}f", 1, "hello", 3.0);
``` ```
...@@ -174,7 +174,7 @@ Checks whether printing is enabled for a domain, tag, or log level. ...@@ -174,7 +174,7 @@ Checks whether printing is enabled for a domain, tag, or log level.
**Example** **Example**
``` ```js
hilog.isLoggable(0xFF00, "testTag", hilog.DEBUG); hilog.isLoggable(0xFF00, "testTag", hilog.DEBUG);
``` ```
......
...@@ -6,7 +6,7 @@ ...@@ -6,7 +6,7 @@
## 导入模块 ## 导入模块
``` ```js
import hiAppEvent from '@ohos.hiAppEvent'; import hiAppEvent from '@ohos.hiAppEvent';
``` ```
...@@ -30,7 +30,7 @@ write(eventName: string, eventType: EventType, keyValues: object, callback: Asyn ...@@ -30,7 +30,7 @@ write(eventName: string, eventType: EventType, keyValues: object, callback: Asyn
**示例:** **示例:**
``` ```js
hiAppEvent.write("test_event", hiAppEvent.EventType.FAULT, {"int_data":100, "str_data":"strValue"}, (err, value) => { hiAppEvent.write("test_event", hiAppEvent.EventType.FAULT, {"int_data":100, "str_data":"strValue"}, (err, value) => {
if (err) { if (err) {
// 事件写入异常:事件存在异常参数时忽略异常参数后继续写入,或者事件校验失败时不执行写入 // 事件写入异常:事件存在异常参数时忽略异常参数后继续写入,或者事件校验失败时不执行写入
...@@ -68,7 +68,7 @@ write(eventName: string, eventType: EventType, keyValues: object): Promise<vo ...@@ -68,7 +68,7 @@ write(eventName: string, eventType: EventType, keyValues: object): Promise<vo
**示例:** **示例:**
``` ```js
hiAppEvent.write("test_event", hiAppEvent.EventType.FAULT, {"int_data":100, "str_data":"strValue"}) hiAppEvent.write("test_event", hiAppEvent.EventType.FAULT, {"int_data":100, "str_data":"strValue"})
.then((value) => { .then((value) => {
// 事件写入正常 // 事件写入正常
...@@ -101,7 +101,7 @@ configure(config: ConfigOption): boolean ...@@ -101,7 +101,7 @@ configure(config: ConfigOption): boolean
| boolean | 配置结果,true 表示配置成功,false 表示配置失败。 | | boolean | 配置结果,true 表示配置成功,false 表示配置失败。 |
**示例:** **示例:**
``` ```js
// 配置应用事件打点功能开关 // 配置应用事件打点功能开关
hiAppEvent.configure({ hiAppEvent.configure({
disable: true disable: true
......
...@@ -6,7 +6,7 @@ ...@@ -6,7 +6,7 @@
## 导入模块 ## 导入模块
``` ```js
import hilog from '@ohos.hilog'; import hilog from '@ohos.hilog';
``` ```
...@@ -30,7 +30,7 @@ debug日志输出,打印debug级别日志。 ...@@ -30,7 +30,7 @@ debug日志输出,打印debug级别日志。
**示例:** **示例:**
``` ```js
hilog.debug(0xFF00, "testTag", "%d: %{private}s World %{public}f", 1, "hello", 3.0); hilog.debug(0xFF00, "testTag", "%d: %{private}s World %{public}f", 1, "hello", 3.0);
``` ```
...@@ -59,7 +59,7 @@ info日志输出,打印info级别日志。 ...@@ -59,7 +59,7 @@ info日志输出,打印info级别日志。
**示例:** **示例:**
``` ```js
hilog.info(0xFF00, "testTag", "%d: %{private}s World %{public}f", 1, "hello", 3.0); hilog.info(0xFF00, "testTag", "%d: %{private}s World %{public}f", 1, "hello", 3.0);
``` ```
...@@ -88,7 +88,7 @@ warn日志输出,打印warn级别日志。 ...@@ -88,7 +88,7 @@ warn日志输出,打印warn级别日志。
**示例:** **示例:**
``` ```js
hilog.warn(0xFF00, "testTag", "%d: %{private}s World %{public}f", 1, "hello", 3.0); hilog.warn(0xFF00, "testTag", "%d: %{private}s World %{public}f", 1, "hello", 3.0);
``` ```
...@@ -117,7 +117,7 @@ error日志输出,打印error级别日志。 ...@@ -117,7 +117,7 @@ error日志输出,打印error级别日志。
**示例:** **示例:**
``` ```js
hilog.error(0xFF00, "testTag", "%d: %{private}s World %{public}f", 1, "hello", 3.0); hilog.error(0xFF00, "testTag", "%d: %{private}s World %{public}f", 1, "hello", 3.0);
``` ```
...@@ -146,7 +146,7 @@ fatal日志输出,打印fatal级别日志。 ...@@ -146,7 +146,7 @@ fatal日志输出,打印fatal级别日志。
**示例:** **示例:**
``` ```js
hilog.fatal(0xFF00, "testTag", "%d: %{private}s World %{public}f", 1, "hello", 3.0); hilog.fatal(0xFF00, "testTag", "%d: %{private}s World %{public}f", 1, "hello", 3.0);
``` ```
...@@ -174,7 +174,7 @@ isLoggable(domain: number, tag: string, level: LogLevel) : boolean ...@@ -174,7 +174,7 @@ isLoggable(domain: number, tag: string, level: LogLevel) : boolean
**示例:** **示例:**
``` ```js
hilog.isLoggable(0xFF00, "testTag", hilog.DEBUG); hilog.isLoggable(0xFF00, "testTag", hilog.DEBUG);
``` ```
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册