未验证 提交 ec39704f 编写于 作者: O openharmony_ci 提交者: Gitee

!23926 【monthly0815分支挑单】编码风格保持一致,语句结束加上分号。

Merge pull request !23926 from honghecun/cherry-pick-1693901490
...@@ -57,13 +57,13 @@ hiTraceChain是基于云计算分布式跟踪调用链思想,在端侧业务 ...@@ -57,13 +57,13 @@ hiTraceChain是基于云计算分布式跟踪调用链思想,在端侧业务
'PACKAGE_NAME': "com.demo.hitracechain", 'PACKAGE_NAME': "com.demo.hitracechain",
'PROCESS_NAME': "hitracechaindemo", 'PROCESS_NAME': "hitracechaindemo",
'MSG': "no msg." 'MSG': "no msg."
} };
let eventInfo: hiSysEvent.SysEventInfo = { let eventInfo: hiSysEvent.SysEventInfo = {
domain: "RELIABILITY", domain: "RELIABILITY",
name: "STACK", name: "STACK",
eventType: hiSysEvent.EventType.FAULT, eventType: hiSysEvent.EventType.FAULT,
params: customizedParams params: customizedParams
} };
hiSysEvent.write(eventInfo).then((val: number) => { hiSysEvent.write(eventInfo).then((val: number) => {
console.info(`write result is ${val}`); console.info(`write result is ${val}`);
// 业务结束,关闭分布式跟踪。 // 业务结束,关闭分布式跟踪。
......
...@@ -163,7 +163,7 @@ try { ...@@ -163,7 +163,7 @@ try {
(err: BusinessError) => { (err: BusinessError) => {
console.error(`error code: ${err.code}, error msg: ${err.message}`); console.error(`error code: ${err.code}, error msg: ${err.message}`);
} }
) );
} catch (err) { } catch (err) {
console.error(`error code: ${(err as BusinessError).code}, error msg: ${(err as BusinessError).message}`); console.error(`error code: ${(err as BusinessError).code}, error msg: ${(err as BusinessError).message}`);
} }
...@@ -251,9 +251,9 @@ let watcher: hiSysEvent.Watcher = { ...@@ -251,9 +251,9 @@ let watcher: hiSysEvent.Watcher = {
onServiceDied: () => { onServiceDied: () => {
// do something here. // do something here.
} }
} };
try { try {
hiSysEvent.addWatcher(watcher) hiSysEvent.addWatcher(watcher);
} catch (err) { } catch (err) {
console.error(`error code: ${(err as BusinessError).code}, error msg: ${(err as BusinessError).message}`); console.error(`error code: ${(err as BusinessError).code}, error msg: ${(err as BusinessError).message}`);
} }
...@@ -294,7 +294,7 @@ let watchRules: hiSysEvent.WatchRule[] = [{ ...@@ -294,7 +294,7 @@ let watchRules: hiSysEvent.WatchRule[] = [{
name: "STACK", name: "STACK",
tag: "STABILITY", tag: "STABILITY",
ruleType: hiSysEvent.RuleType.WHOLE_WORD, ruleType: hiSysEvent.RuleType.WHOLE_WORD,
} as hiSysEvent.WatchRule ] } as hiSysEvent.WatchRule ];
let watcher: hiSysEvent.Watcher = { let watcher: hiSysEvent.Watcher = {
rules: watchRules, rules: watchRules,
onEvent: (info: hiSysEvent.SysEventInfo) => { onEvent: (info: hiSysEvent.SysEventInfo) => {
...@@ -303,10 +303,10 @@ let watcher: hiSysEvent.Watcher = { ...@@ -303,10 +303,10 @@ let watcher: hiSysEvent.Watcher = {
onServiceDied: () => { onServiceDied: () => {
// do something here. // do something here.
} }
} };
try { try {
hiSysEvent.addWatcher(watcher) hiSysEvent.addWatcher(watcher);
hiSysEvent.removeWatcher(watcher) hiSysEvent.removeWatcher(watcher);
} catch (err) { } catch (err) {
console.error(`error code: ${(err as BusinessError).code}, error msg: ${(err as BusinessError).message}`); console.error(`error code: ${(err as BusinessError).code}, error msg: ${(err as BusinessError).message}`);
} }
...@@ -400,7 +400,7 @@ try { ...@@ -400,7 +400,7 @@ try {
}; };
hiSysEvent.write(eventInfo, (err: BusinessError, val: number) => { hiSysEvent.write(eventInfo, (err: BusinessError, val: number) => {
// do something here. // do something here.
}) });
let queryArg: hiSysEvent.QueryArg = { let queryArg: hiSysEvent.QueryArg = {
beginTime: -1, beginTime: -1,
...@@ -410,7 +410,7 @@ try { ...@@ -410,7 +410,7 @@ try {
let queryRules: hiSysEvent.QueryRule[] = [{ let queryRules: hiSysEvent.QueryRule[] = [{
domain: "RELIABILITY", domain: "RELIABILITY",
names: ["STACK"], names: ["STACK"],
} as hiSysEvent.QueryRule] } as hiSysEvent.QueryRule];
let querier: hiSysEvent.Querier = { let querier: hiSysEvent.Querier = {
onQuery: (infos: hiSysEvent.SysEventInfo[]) => { onQuery: (infos: hiSysEvent.SysEventInfo[]) => {
// do something here. // do something here.
...@@ -418,8 +418,8 @@ try { ...@@ -418,8 +418,8 @@ try {
onComplete: (reason: number, total: number) => { onComplete: (reason: number, total: number) => {
// do something here. // do something here.
} }
} };
hiSysEvent.query(queryArg, queryRules, querier) hiSysEvent.query(queryArg, queryRules, querier);
} catch (err) { } catch (err) {
console.error(`error code: ${(err as BusinessError).code}, error msg: ${(err as BusinessError).message}`); console.error(`error code: ${(err as BusinessError).code}, error msg: ${(err as BusinessError).message}`);
} }
...@@ -481,18 +481,18 @@ try { ...@@ -481,18 +481,18 @@ try {
}; };
hiSysEvent.write(eventInfo, (err: BusinessError, val: number) => { hiSysEvent.write(eventInfo, (err: BusinessError, val: number) => {
// do something here. // do something here.
}) });
let queryArg: hiSysEvent.QueryArg = { let queryArg: hiSysEvent.QueryArg = {
beginTime: -1, beginTime: -1,
endTime: -1, endTime: -1,
maxEvents: 1, maxEvents: 1,
} };
let queryRules: hiSysEvent.QueryRule[] = [{ let queryRules: hiSysEvent.QueryRule[] = [{
domain: "RELIABILITY", domain: "RELIABILITY",
names: ["STACK"], names: ["STACK"],
} as hiSysEvent.QueryRule] } as hiSysEvent.QueryRule];
let time = hiSysEvent.exportSysEvents(queryArg, queryRules) let time = hiSysEvent.exportSysEvents(queryArg, queryRules);
console.log(`receive export task time is : ${time}`); console.log(`receive export task time is : ${time}`);
// 延迟读取本次导出的事件 // 延迟读取本次导出的事件
...@@ -506,7 +506,7 @@ try { ...@@ -506,7 +506,7 @@ try {
console.log("read file end, events is :" + JSON.stringify(events)); console.log("read file end, events is :" + JSON.stringify(events));
} }
} }
}, 10000) }, 10000);
} catch catch (err) { } catch catch (err) {
console.error(`error code: ${(err as BusinessError).code}, error msg: ${(err as BusinessError).message}`); console.error(`error code: ${(err as BusinessError).code}, error msg: ${(err as BusinessError).message}`);
} }
...@@ -559,7 +559,7 @@ try { ...@@ -559,7 +559,7 @@ try {
domain: "BUNDLE_MANAGER", domain: "BUNDLE_MANAGER",
names: ["BUNDLE_UNINSTALL"], names: ["BUNDLE_UNINSTALL"],
} as hiSysEvent.QueryRule]; } as hiSysEvent.QueryRule];
hiSysEvent.subscribe(rules) hiSysEvent.subscribe(rules);
let customizedParams: Record<string, string | number> = { let customizedParams: Record<string, string | number> = {
'PID': 487, 'PID': 487,
...@@ -576,7 +576,7 @@ try { ...@@ -576,7 +576,7 @@ try {
}; };
hiSysEvent.write(eventInfo, (err: BusinessError, val: number) => { hiSysEvent.write(eventInfo, (err: BusinessError, val: number) => {
// do something here. // do something here.
}) });
// 延迟读取订阅的事件 // 延迟读取订阅的事件
setTimeout(() => { setTimeout(() => {
...@@ -587,7 +587,7 @@ try { ...@@ -587,7 +587,7 @@ try {
let events: string = JSON.parse('[' + res.slice(0, res.length - 1) + ']'); let events: string = JSON.parse('[' + res.slice(0, res.length - 1) + ']');
console.log("read file end, events is :" + JSON.stringify(events)); console.log("read file end, events is :" + JSON.stringify(events));
} }
}, 10000) }, 10000);
} catch catch (err) { } catch catch (err) {
console.error(`error code: ${(err as BusinessError).code}, error msg: ${(err as BusinessError).message}`); console.error(`error code: ${(err as BusinessError).code}, error msg: ${(err as BusinessError).message}`);
} }
...@@ -626,7 +626,7 @@ try { ...@@ -626,7 +626,7 @@ try {
domain: "BUNDLE_MANAGER", domain: "BUNDLE_MANAGER",
names: ["BUNDLE_UNINSTALL"], names: ["BUNDLE_UNINSTALL"],
} as hiSysEvent.QueryRule]; } as hiSysEvent.QueryRule];
hiSysEvent.subscribe(rules) hiSysEvent.subscribe(rules);
hiSysEvent.unsubscribe(); hiSysEvent.unsubscribe();
} catch (err) { } catch (err) {
console.error(`error code: ${(err as BusinessError).code}, error msg: ${(err as BusinessError).message}`); console.error(`error code: ${(err as BusinessError).code}, error msg: ${(err as BusinessError).message}`);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册