Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
从命令行启动节点时如何设置节点的日志级别?我承认,我是 node.js 新手,但正在寻找类似的东西node myapp.js --loglevel warn
node myapp.js --loglevel warn
不太可能完全符合您的要求,但您可以通过首先设置 NODE_DEBUG 环境变量在节点内启用调试。
例如export NODE_DEBUG="net" && node myapp.js,将为网络相关节点操作提供调试。
export NODE_DEBUG="net" && node myapp.js
https://github.com/joyent/node/blob/master/lib/net.js#L66