1# Log 2 3The Log module provides basic log printing capabilities and supports log printing by log level. 4 5If you want to use more advanced log printing services, for example, filtering logs by the specified ID, you are advised to use [`@ohos.hilog`](js-apis-hilog.md). 6 7> **NOTE**<br> 8> The initial APIs of this module are supported since API version 3. Newly added APIs will be marked with a superscript to indicate their earliest API version. 9 10 11## console.log 12 13log(message: string): void 14 15Prints logs. 16 17**System capability**: SystemCapability.ArkUI.ArkUI.Full 18 19**Parameters** 20 21| Name | Type | Mandatory | Description | 22| ------- | ------ | ---- | ----------- | 23| message | string | Yes | Text to print.| 24 25 26## console.debug 27 28debug(message: string): void 29 30Prints debug-level logs. 31 32**System capability**: SystemCapability.ArkUI.ArkUI.Full 33 34**Parameters** 35 36| Name | Type | Mandatory | Description | 37| ------- | ------ | ---- | ----------- | 38| message | string | Yes | Text to print.| 39 40 41## console.info 42 43info(message: string): void 44 45Prints info-level logs. 46 47**System capability**: SystemCapability.ArkUI.ArkUI.Full 48 49**Parameters** 50 51| Name | Type | Mandatory | Description | 52| ------- | ------ | ---- | ----------- | 53| message | string | Yes | Text to print.| 54 55 56## console.warn 57 58warn(message: string): void 59 60Prints warn-level logs. 61 62**System capability**: SystemCapability.ArkUI.ArkUI.Full 63 64**Parameters** 65 66| Name | Type | Mandatory | Description | 67| ------- | ------ | ---- | ----------- | 68| message | string | Yes | Text to print.| 69 70 71## console.error 72 73error(message: string): void 74 75Prints error-level logs. 76 77**System capability**: SystemCapability.ArkUI.ArkUI.Full 78 79**Parameters** 80 81| Name | Type | Mandatory | Description | 82| ------- | ------ | ---- | ----------- | 83| message | string | Yes | Text to print.| 84 85 86## Example 87 88``` 89export default { 90 clickConsole(){ 91 var versionCode = 1; 92 console.info('Hello World. The current version code is ' + versionCode); 93 console.log(`versionCode: ${versionCode}`); 94 / / The following is supported since API version 6: console.log('versionCode:%d.', versionCode); 95 } 96} 97``` 98 99Switch 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. 100 101 102