# 日志打印
- [导入模块](#zh-cn_topic_0000001127284842_s56d19203690d4782bfc74069abb6bd71)
- [权限列表](#zh-cn_topic_0000001127284842_section11257113618419)
- [console.debug](#zh-cn_topic_0000001127284842_s298a3cf59a3b470dbb0742706102ced7)
- [console.log](#zh-cn_topic_0000001127284842_section146351482051)
- [console.info](#zh-cn_topic_0000001127284842_section93434457711)
- [console.warn](#zh-cn_topic_0000001127284842_section1363520541678)
- [console.error](#zh-cn_topic_0000001127284842_section326012551578)
- [示例](#zh-cn_topic_0000001127284842_section738673813104)
## 导入模块
无需导入。
## 权限列表
无
## console.debug
debug\(message: string\): void
打印debug级别的日志信息。
- 参数
参数名
|
类型
|
必填
|
说明
|
message
|
string
|
是
|
表示要打印的文本信息。
|
## console.log
log\(message: string\): void
打印log级别的日志信息。
- 参数
参数名
|
类型
|
必填
|
说明
|
message
|
string
|
是
|
表示要打印的文本信息。
|
> **说明:**
>console.log\(\)打印的是debug级别日志信息。
## console.info
info\(message: string\): void
打印info级别的日志信息。
- 参数
参数名
|
类型
|
必填
|
说明
|
message
|
string
|
是
|
表示要打印的文本信息。
|
## console.warn
warn\(message: string\): void
打印warn级别的日志信息。
- 参数
参数名
|
类型
|
必填
|
说明
|
message
|
string
|
是
|
表示要打印的文本信息。
|
## console.error
error\(message: string\): void
打印error级别的日志信息。
- 参数
参数名
|
类型
|
必填
|
说明
|
message
|
string
|
是
|
表示要打印的文本信息。
|
## 示例
```
var versionCode = 1;
console.info('Hello World. The current version code is ' + versionCode);
console.log(`versionCode: ${versionCode}`)
console.log('versionCode:%d.', versionCode);6+
```
在DevEco Studio的底部,切换到“HiLog”窗口。选择当前的设备及进程,日志级别选择Info,搜索内容设置为“Hello World”。此时窗口仅显示符合条件的日志,效果如图所示:
