diff --git a/en/application-dev/reference/apis/figures/en-us_image_0000001200913929.png b/en/application-dev/reference/apis/figures/en-us_image_0000001200913929.png new file mode 100644 index 0000000000000000000000000000000000000000..6eb89772d315b440636e8ceeda928e5db6b34e40 Binary files /dev/null and b/en/application-dev/reference/apis/figures/en-us_image_0000001200913929.png differ diff --git a/en/application-dev/reference/apis/js-apis-logs.md b/en/application-dev/reference/apis/js-apis-logs.md index 864ce3ecc2e4ff92feebd0079fb597d8d55ee264..e2d0aff5a5eec1f468b0511a08f1f593a9af3548 100644 --- a/en/application-dev/reference/apis/js-apis-logs.md +++ b/en/application-dev/reference/apis/js-apis-logs.md @@ -1,174 +1,69 @@ -# Console Logs +# Log -## Module to Import +> ![icon-note.gif](public_sys-resources/icon-note.gif) **NOTE** +> The APIs of this module are no longer maintained since API version 7. You are advised to use ['@ohos.hilog](js-apis-hilog.md)' instead. -No module is required. +## console.debug -## Required Permissions +debug(message: string): void -None +Prints debug logs. -## console.debug +- Parameters + | Name | Type | Mandatory | Description | + | ------- | ------ | ---- | ----------- | + | message | string | Yes | Text to print.| -debug\(message: string\): void -Prints debug logs. +## console.log -- Parameters - - - - - - - - - - - - - - -

Name

-

Type

-

Mandatory

-

Description

-

message

-

string

-

Yes

-

Text to print.

-
- - -## console.log - -log\(message: string\): void +log(message: string): void Prints debug logs. -- Parameter - - - - - - - - - - - - - - -

Name

-

Type

-

Mandatory

-

Description

-

message

-

string

-

Yes

-

Text to print.

-
- - -## console.info - -info\(message: string\): void +- Parameters + | Name | Type | Mandatory | Description | + | ------- | ------ | ---- | ----------- | + | message | string | Yes | Text to print.| + + +## console.info + +info(message: string): void Prints info-level logs. -- Parameters - - - - - - - - - - - - - - -

Name

-

Type

-

Mandatory

-

Description

-

message

-

string

-

Yes

-

Text to print.

-
- - -## console.warn - -warn\(message: string\): void +- Parameters + | Name | Type | Mandatory | Description | + | ------- | ------ | ---- | ----------- | + | message | string | Yes | Text to print.| + + +## console.warn + +warn(message: string): void Prints warn-level logs. -- Parameters - - - - - - - - - - - - - - -

Name

-

Type

-

Mandatory

-

Description

-

message

-

string

-

Yes

-

Text to print.

-
- - -## console.error - -error\(message: string\): void +- Parameters + | Name | Type | Mandatory | Description | + | ------- | ------ | ---- | ----------- | + | message | string | Yes | Text to print.| + + +## console.error + +error(message: string): void Prints error-level logs. -- Parameters - - - - - - - - - - - - - - -

Name

-

Type

-

Mandatory

-

Description

-

message

-

string

-

Yes

-

Text to print.

-
- - -## Example +- Parameters + | Name | Type | Mandatory | Description | + | ------- | ------ | ---- | ----------- | + | message | string | Yes | Text to print.| + + +## Example ``` export default { @@ -176,13 +71,11 @@ export default { var versionCode = 1; console.info('Hello World. The current version code is ' + versionCode); console.log(`versionCode: ${versionCode}`); - // The following is supported since API version 6. - console.log('versionCode:%d.', versionCode); + / / The following is supported since API version 6: console.log('versionCode:%d.', versionCode); } } ``` -Switch to the **HiLog** window at the bottom of HUAWEI DevEco Studio. Specifically, select the current device and process, set the log level to **Info**, and enter **Hello World** in the search box. Logs that meet the search criteria are displayed, as shown in the following figure. - -![](figures/log.png) +Switch to the HiLog window at the bottom of HUAWEI DevEco Studio. Specifically, select the current device and process, set the log level to Info, and enter Hello World in the search box. Logs that meet the search criteria are displayed, as shown in the following figure. +![en-us_image_0000001200913929](figures/en-us_image_0000001200913929.png)