diff --git a/zh-cn/application-dev/dfx/hitracechain-guidelines.md b/zh-cn/application-dev/dfx/hitracechain-guidelines.md index 885f279aa41c61cc93c14c92f443ab14a3e4f84b..4736b8e9d1d2a67429cd523149705c8be7dda688 100644 --- a/zh-cn/application-dev/dfx/hitracechain-guidelines.md +++ b/zh-cn/application-dev/dfx/hitracechain-guidelines.md @@ -57,13 +57,13 @@ hiTraceChain是基于云计算分布式跟踪调用链思想,在端侧业务 'PACKAGE_NAME': "com.demo.hitracechain", 'PROCESS_NAME': "hitracechaindemo", 'MSG': "no msg." - } + }; let eventInfo: hiSysEvent.SysEventInfo = { domain: "RELIABILITY", name: "STACK", eventType: hiSysEvent.EventType.FAULT, params: customizedParams - } + }; hiSysEvent.write(eventInfo).then((val: number) => { console.info(`write result is ${val}`); // 业务结束,关闭分布式跟踪。 diff --git a/zh-cn/application-dev/reference/apis/js-apis-hisysevent.md b/zh-cn/application-dev/reference/apis/js-apis-hisysevent.md index 7ac275b6af0199f875f315546092cde5d4c9b778..7e666a6b702e2a897281f8132ec49c7e2cbef498 100644 --- a/zh-cn/application-dev/reference/apis/js-apis-hisysevent.md +++ b/zh-cn/application-dev/reference/apis/js-apis-hisysevent.md @@ -163,7 +163,7 @@ try { (err: BusinessError) => { console.error(`error code: ${err.code}, error msg: ${err.message}`); } - ) + ); } catch (err) { console.error(`error code: ${(err as BusinessError).code}, error msg: ${(err as BusinessError).message}`); } @@ -251,9 +251,9 @@ let watcher: hiSysEvent.Watcher = { onServiceDied: () => { // do something here. } -} +}; try { - hiSysEvent.addWatcher(watcher) + hiSysEvent.addWatcher(watcher); } catch (err) { console.error(`error code: ${(err as BusinessError).code}, error msg: ${(err as BusinessError).message}`); } @@ -294,7 +294,7 @@ let watchRules: hiSysEvent.WatchRule[] = [{ name: "STACK", tag: "STABILITY", ruleType: hiSysEvent.RuleType.WHOLE_WORD, - } as hiSysEvent.WatchRule ] + } as hiSysEvent.WatchRule ]; let watcher: hiSysEvent.Watcher = { rules: watchRules, onEvent: (info: hiSysEvent.SysEventInfo) => { @@ -303,10 +303,10 @@ let watcher: hiSysEvent.Watcher = { onServiceDied: () => { // do something here. } -} +}; try { - hiSysEvent.addWatcher(watcher) - hiSysEvent.removeWatcher(watcher) + hiSysEvent.addWatcher(watcher); + hiSysEvent.removeWatcher(watcher); } catch (err) { console.error(`error code: ${(err as BusinessError).code}, error msg: ${(err as BusinessError).message}`); } @@ -400,7 +400,7 @@ try { }; hiSysEvent.write(eventInfo, (err: BusinessError, val: number) => { // do something here. - }) + }); let queryArg: hiSysEvent.QueryArg = { beginTime: -1, @@ -410,7 +410,7 @@ try { let queryRules: hiSysEvent.QueryRule[] = [{ domain: "RELIABILITY", names: ["STACK"], - } as hiSysEvent.QueryRule] + } as hiSysEvent.QueryRule]; let querier: hiSysEvent.Querier = { onQuery: (infos: hiSysEvent.SysEventInfo[]) => { // do something here. @@ -418,8 +418,8 @@ try { onComplete: (reason: number, total: number) => { // do something here. } - } - hiSysEvent.query(queryArg, queryRules, querier) + }; + hiSysEvent.query(queryArg, queryRules, querier); } catch (err) { console.error(`error code: ${(err as BusinessError).code}, error msg: ${(err as BusinessError).message}`); } @@ -481,18 +481,18 @@ try { }; hiSysEvent.write(eventInfo, (err: BusinessError, val: number) => { // do something here. - }) + }); let queryArg: hiSysEvent.QueryArg = { beginTime: -1, endTime: -1, maxEvents: 1, - } + }; let queryRules: hiSysEvent.QueryRule[] = [{ domain: "RELIABILITY", names: ["STACK"], - } as hiSysEvent.QueryRule] - let time = hiSysEvent.exportSysEvents(queryArg, queryRules) + } as hiSysEvent.QueryRule]; + let time = hiSysEvent.exportSysEvents(queryArg, queryRules); console.log(`receive export task time is : ${time}`); // 延迟读取本次导出的事件 @@ -506,7 +506,7 @@ try { console.log("read file end, events is :" + JSON.stringify(events)); } } - }, 10000) + }, 10000); } catch catch (err) { console.error(`error code: ${(err as BusinessError).code}, error msg: ${(err as BusinessError).message}`); } @@ -559,7 +559,7 @@ try { domain: "BUNDLE_MANAGER", names: ["BUNDLE_UNINSTALL"], } as hiSysEvent.QueryRule]; - hiSysEvent.subscribe(rules) + hiSysEvent.subscribe(rules); let customizedParams: Record = { 'PID': 487, @@ -576,7 +576,7 @@ try { }; hiSysEvent.write(eventInfo, (err: BusinessError, val: number) => { // do something here. - }) + }); // 延迟读取订阅的事件 setTimeout(() => { @@ -587,7 +587,7 @@ try { let events: string = JSON.parse('[' + res.slice(0, res.length - 1) + ']'); console.log("read file end, events is :" + JSON.stringify(events)); } - }, 10000) + }, 10000); } catch catch (err) { console.error(`error code: ${(err as BusinessError).code}, error msg: ${(err as BusinessError).message}`); } @@ -626,7 +626,7 @@ try { domain: "BUNDLE_MANAGER", names: ["BUNDLE_UNINSTALL"], } as hiSysEvent.QueryRule]; - hiSysEvent.subscribe(rules) + hiSysEvent.subscribe(rules); hiSysEvent.unsubscribe(); } catch (err) { console.error(`error code: ${(err as BusinessError).code}, error msg: ${(err as BusinessError).message}`);