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

!5589 翻译已完成 5131

Merge pull request !5589 from shawn_he/5131-b
# HiLog
The HiLog subsystem allows your applications or services to output logs based on the specified type, level, and format string. Such logs help you learn the running status of applications and better debug programs.
This document describes only API functions. For details about log printing requirements, see [Logging Guide](../../../contribute/OpenHarmony-Log-guide.md).
> **NOTE**<br>
> The initial APIs of this module are supported since API version 7. Newly added APIs will be marked with a superscript to indicate their earliest API version.
......
......@@ -408,7 +408,7 @@ Checks whether the current device supports 5G \(NR\).
```js
let slotId = 0;
let result = radio.isNrSupported(slotId);
console.log(result);
console.log("Result: "+ result);
```
......
......@@ -521,7 +521,7 @@ Obtains the number of card slots.
**Example**
```js
console.log(sim.getMaxSimCount())
console.log("Result: "+ sim.getMaxSimCount())
```
......
......@@ -23,7 +23,7 @@ import webSocket from '@ohos.net.webSocket';
var defaultIpAddress = "ws://";
let ws = webSocket.createWebSocket();
ws.on('open', (err, value) => {
console.log("on open, status:" + value.status + ", message:" + value.message);
console.log("on open, status:" + value['status'] + ", message:" + value['message']);
// When receiving the on('open') event, the client can use the send() API to communicate with the server.
ws.send("Hello, server!", (err, value) => {
if (!err) {
......@@ -47,7 +47,7 @@ ws.on('message', (err, value) => {
}
});
ws.on('close', (err, value) => {
console.log("on close, code is " + value.code + ", reason is " + value.reason);
console.log("on close, code is " + value['code'] + ", reason is " + value['reason']);
});
ws.on('error', (err) => {
console.log("on error, error:" + JSON.stringify(err));
......@@ -393,7 +393,7 @@ Enables listening for the **open** events of a WebSocket connection. This API us
```js
let ws = webSocket.createWebSocket();
ws.on('open', (err, value) => {
console.log("on open, status:" + value.status + ", message:" + value.message);
console.log("on open, status:" + value['status'] + ", message:" + value['message']);
});
```
......@@ -421,7 +421,7 @@ Disables listening for the **open** events of a WebSocket connection. This API u
```js
let ws = webSocket.createWebSocket();
let callback1 = (err, value) => {
console.log("on open, status:" + value.status + ", message:" + value.message);
console.log("on open, status:" + value['status'] + ", message:" + value['message']);
}
ws.on('open', callback1);
// You can pass the callback of the on function to cancel listening for a certain type of callback. If you do not pass the callback, you will cancel listening for all callbacks.
......@@ -505,7 +505,7 @@ Enables listening for the **close** events of a WebSocket connection. This API u
```js
let ws = webSocket.createWebSocket();
ws.on('close', (err, value) => {
console.log("on close, code is " + value.code + ", reason is " + value.reason);
console.log("on close, code is " + value['code'] + ", reason is " + value['reason']);
});
```
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册