node.js全局变量console总结

来源:互联网 发布:阿里云免费域名注册 编辑:程序博客网 时间:2024/04/29 17:17

使用工具为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 logthis is an info

重定向符号 1> 和 2>


在login.txt中是

this is a logthis is an info

在err.txt中是

this is a warnthis is an error

1> 相当于> 

2>是将error()和warn()输出




1 0
原创粉丝点击