使用工具为HBuilder,编程语言为javascript
console.log("this is a log");
console.info("this is an info");
console.warn("this is a warn");
console.error('this is an error');
在控制台得到的结果为
"this is a log"
"this is an info"
"this is a warn"
"this is an error"
使用cmd得到相同的结果。
日志的重定向:>(尖括号重定向)

尖括号重定向是对log()和info()的输出,在log.txt文件中是这样的
this is a log
this is an info
重定向符号 1> 和 2>

在login.txt中是
this is a log
this is an info
在err.txt中是
this is a warn
this is an error
1> 相当于>
2>是将error()和warn()输出
最后
以上就是不安雪糕最近收集整理的关于node.js全局变量console总结的全部内容,更多相关node内容请搜索靠谱客的其他文章。
本图文内容来源于网友提供,作为学习参考使用,或来自网络收集整理,版权属于原作者所有。
发表评论 取消回复