diff --git a/en/application-dev/dfx/hilog-guidelines.md b/en/application-dev/dfx/hilog-guidelines.md
index a399a520ba96aa3a64eea8968ed359c05da5440b..eb9d56a3396aa8907569ecf0f5414e684e638bc0 100644
--- a/en/application-dev/dfx/hilog-guidelines.md
+++ b/en/application-dev/dfx/hilog-guidelines.md
@@ -1,26 +1,20 @@
# HiLog Development (Native)
-
## Introduction
-
HiLog is the log system of OpenHarmony that provides logging for the system framework, services, and applications to record information on user operations and system running status.
-
> **NOTE**
->
> This development guide is applicable only when you use Native APIs for application development. For details about the APIs, see [HiLog Native API Reference](../reference/native-apis/_hi_log.md).
## Available APIs
-
| API/Macro| Description|
| -------- | -------- |
| int OH_LOG_Print(LogType type, LogLevel level, unsigned int domain, const char *tag, const char *fmt, ...) | Outputs logs based on the specified log type, log level, service domain, log tag, and variable parameters determined by the format specifier and privacy identifier in the printf format. Input arguments: See [Parameter Description](#parameter-description). Output arguments: None Return value: total number of bytes if log printing is successful; **-1** otherwise.|
-| #define OH_LOG_DEBUG(type, ...) ((void)OH_LOG_Print((type), LOG_DEBUG, LOG_DOMAIN, LOG_TAG, \_*VA*ARGS__))| Outputs DEBUG logs. This is a function-like macro.|
-| #define OH_LOG_INFO(type, ...) ((void)OH_LOG_Print((type), LOG_INFO, LOG_DOMAIN, LOG_TAG, \_*VA*ARGS__)) | Outputs INFO logs. This is a function-like macro.|
-| #define OH_LOG_WARN(type, ...) ((void)OH_LOG_Print((type), LOG_WARN, LOG_DOMAIN, LOG_TAG, \_*VA*ARGS__)) | Outputs WARN logs. This is a function-like macro.|
-| #define OH_LOG_ERROR(type, ...) ((void)OH_LOG_Print((type), LOG_ERROR, LOG_DOMAIN, LOG_TAG, \_*VA*ARGS__)) | Outputs ERROR logs. This is a function-like macro.|
-| #define OH_LOG_FATAL(type, ...) ((void)OH_LOG_Print((type), LOG_FATAL, LOG_DOMAIN, LOG_TAG, \_*VA*ARGS__)) | Outputs FATAL logs. This is a function-like macro.|
+| #define OH_LOG_DEBUG(type, ...) ((void)OH_LOG_Print((type), LOG_DEBUG, LOG_DOMAIN, LOG_TAG, \__VA_ARGS__))| Outputs DEBUG logs. This is a function-like macro.|
+| #define OH_LOG_INFO(type, ...) ((void)OH_LOG_Print((type), LOG_INFO, LOG_DOMAIN, LOG_TAG, \__VA_ARGS__)) | Outputs INFO logs. This is a function-like macro.|
+| #define OH_LOG_WARN(type, ...) ((void)OH_LOG_Print((type), LOG_WARN, LOG_DOMAIN, LOG_TAG, \__VA_ARGS__)) | Outputs WARN logs. This is a function-like macro.|
+| #define OH_LOG_ERROR(type, ...) ((void)OH_LOG_Print((type), LOG_ERROR, LOG_DOMAIN, LOG_TAG, \__VA_ARGS__)) | Outputs ERROR logs. This is a function-like macro.|
+| #define OH_LOG_FATAL(type, ...) ((void)OH_LOG_Print((type), LOG_FATAL, LOG_DOMAIN, LOG_TAG, \__VA_ARGS__)) | Outputs FATAL logs. This is a function-like macro.|
| bool OH_LOG_IsLoggable(unsigned int domain, const char *tag, LogLevel level) | Checks whether logs of the specified service domain, tag, and level can be printed. Input arguments: See [Parameter Description](#parameter-description). Output arguments: none Return value: **true** if the specified logs can be printed; **false** otherwise.|
-
-## Parameter Description
+## Parameter Parsing
| Name| Type | Mandatory| Description |
| ------ | ------ | ---- | ------------------------------------------------------------ |
@@ -30,9 +24,7 @@ HiLog is the log system of OpenHarmony that provides logging for the system fram
| tag | string | Yes | Log tag in the string format. You are advised to use this parameter to identify a particular service behavior or the class holding the ongoing method.|
| fmt | string | Yes | Format string used to output logs in a specified format. It can contain several parameters, where the parameter type and privacy identifier are mandatory. Parameters labeled **{public}** are public data and are displayed in plaintext; parameters labeled **{private}** (default value) are private data and are filtered by **\**.|
| args | any[] | Yes | Variable-length parameter list corresponding to the format string. The number and type of parameters must map to the identifier in the format string.|
-
## LogLevel
-
Log level.
| Name | Value | Description |
@@ -42,9 +34,7 @@ Log level.
| WARN | 5 | Log level used to record severe, unexpected faults that have little impact on users and can be rectified by the programs themselves or through simple operations.|
| ERROR | 6 | Log level used to record program or functional errors that affect the normal running or use of the functionality and can be fixed at a high cost, for example, by resetting data.|
| FATAL | 7 | Log level used to record program or functionality crashes that cannot be rectified.
-
## Development Example
-
1. Add the link of **libhilog_ndk.z.so** to **CMakeLists.txt**:
```
target_link_libraries(entry PUBLIC libhilog_ndk.z.so)
diff --git a/en/application-dev/reference/apis/js-apis-hidebug.md b/en/application-dev/reference/apis/js-apis-hidebug.md
index bf0666974e940393f8da4ec229eeae3e7d59e639..896cee276b582a87806745accf135f74a38c057a 100644
--- a/en/application-dev/reference/apis/js-apis-hidebug.md
+++ b/en/application-dev/reference/apis/js-apis-hidebug.md
@@ -179,18 +179,18 @@ import featureAbility from '@ohos.ability.featureAbility'
let context = featureAbility.getContext();
context.getFilesDir().then((data) => {
- var path = data + "/serviceInfo.txt"
- console.info("output path: " + path)
- let fd = fs.openSync(path, 0o102, 0o666)
- var serviceId = 10
- var args = new Array("allInfo")
+ var path = data + "/serviceInfo.txt";
+ console.info("output path: " + path);
+ let file = fs.openSync(path, fs.OpenMode.READ_WRITE | fs.OpenMode.CREATE);
+ var serviceId = 10;
+ var args = new Array("allInfo");
try {
- hidebug.getServiceDump(serviceId, fd, args)
+ hidebug.getServiceDump(serviceId, file.fd, args);
} catch (error) {
- console.info(error.code)
- console.info(error.message)
+ console.info(error.code);
+ console.info(error.message);
}
- fs.closeSync(fd);
+ fs.closeSync(file);
})
```
diff --git a/en/application-dev/reference/apis/js-apis-http.md b/en/application-dev/reference/apis/js-apis-http.md
index 5b969ff11a9f8157920d9f063b4b3dd99ce6e3aa..905d892ddbd6991d9a8f632fdc34992bfb95e540 100644
--- a/en/application-dev/reference/apis/js-apis-http.md
+++ b/en/application-dev/reference/apis/js-apis-http.md
@@ -16,7 +16,7 @@ import http from '@ohos.net.http';
## Examples
```js
-// Import the HTTP namespace.
+// Import the http namespace.
import http from '@ohos.net.http';
// Each httpRequest corresponds to an HTTP request task and cannot be reused.
@@ -35,17 +35,17 @@ httpRequest.request(
header: {
'Content-Type': 'application/json'
},
- // This field is used to transfer data when the POST request is used.
+ // This parameter is used to transfer data when the POST request is used.
extraData: {
"data": "data to send",
},
- expectDataType: http.HttpDataType.STRING, // Optional. This field specifies the type of the return data.
+ expectDataType: http.HttpDataType.STRING, // Optional. This parameter specifies the type of the return data.
usingCache: true, // Optional. The default value is true.
priority: 1, // Optional. The default value is 1.
connectTimeout: 60000 // Optional. The default value is 60000, in ms.
readTimeout: 60000, // Optional. The default value is 60000, in ms.
usingProtocol: http.HttpProtocol.HTTP1_1, // Optional. The default protocol type is automatically specified by the system.
- usingProxy: false, // Optional. By default, network proxy is not used. This field is supported since API 10.
+ usingProxy: false, // Optional. By default, network proxy is not used. This field is supported since API version 10.
caPath: "", // Optional. The preset CA certificate is used by default. This field is supported since API version 10.
}, (err, data) => {
if (!err) {
@@ -55,13 +55,13 @@ httpRequest.request(
// data.header carries the HTTP response header. Parse the content based on service requirements.
console.info('header:' + JSON.stringify(data.header));
console.info('cookies:' + JSON.stringify(data.cookies)); // 8+
- // Call the destroy() method to release resources after HttpRequest is complete.
+ // Call the destroy() method to release resources after the HttpRequest is complete.
httpRequest.destroy();
} else {
console.info('error:' + JSON.stringify(err));
// Unsubscribe from HTTP Response Header events.
httpRequest.off('headersReceive');
- // Call the destroy() method to release resources after HttpRequest is complete.
+ // Call the destroy() method to release resources after the HttpRequest is complete.
httpRequest.destroy();
}
}
@@ -75,7 +75,7 @@ httpRequest.request(
createHttp(): HttpRequest
-Creates an HTTP request. You can use this API to initiate or destroy an HTTP request, or enable or disable listening for HTTP Response Header events. An HttpRequest object corresponds to an HTTP request. To initiate multiple HTTP requests, you must create an **HttpRequest** object for each HTTP request.
+Creates an HTTP request. You can use this API to initiate or destroy an HTTP request, or enable or disable listening for HTTP Response Header events. An **HttpRequest** object corresponds to an HTTP request. To initiate multiple HTTP requests, you must create an **HttpRequest** object for each HTTP request.
> **NOTE**
> Call the **destroy()** method to release resources after the HttpRequest is complete.
@@ -437,7 +437,7 @@ httpRequest.request2("EXAMPLE_URL", (err, data) => {
request2(url: string, options: HttpRequestOptions, callback: AsyncCallback\): void
-Initiates an HTTP request to a given URL. This API uses an asynchronous callback to return the result, which is a streaming response.
+Initiates an HTTP request containing specified options to a given URL. This API uses an asynchronous callback to return the result, which is a streaming response.
**Required permissions**: ohos.permission.INTERNET
@@ -572,7 +572,7 @@ Initiates an HTTP request containing specified options to a given URL. This API
> **NOTE**
> For details about the error codes, see [HTTP Error Codes](../errorcodes/errorcode-net-http.md).
-> The HTTP error code mapping is in the format of 2300000 + Curl error code. For more common error codes, see:
+> The HTTP error code mapping is in the format of 2300000 + Curl error code. For more common error codes, see [Curl Error Codes](https://curl.se/libcurl/c/libcurl-errors.html).
**Example**
@@ -599,7 +599,7 @@ on(type: 'headerReceive', callback: AsyncCallback\