nodejs 调试
发布于 8 年前 作者 dogsmall 5094 次浏览 来自 问答

You can also set debug: console.log in the connection config objects to get debug output, although you may want to use a custo m function for each connection so you can differentiate output for each connection (e.g. debug: function(s) { console.log('srcServer: ’ + s); } for the srcServer connection config Try enabling debug output and see what is being sent and what the server is replying with when the error occurs. 平时都是到处console.log(xxxx)来判断,昨天收到了这句话,但是不知道该如何使用 debug: console.log这个方法啊,这个方法调试的时候能显示what is being sent and what the server is replying? 我用的是webstorm IDE

9 回复

等会i5ting就会来推荐vs code

var yourFunction = function () {};
yourFunction.prototype.debug = function(s){
	console.log('srcServer'+s)
}

我觉得是这个意思,在server上加一个debug函数,跟IDE没啥关系

@hellopao 哈哈,猜对了,不过还有一篇更完整的

node-debug 三法三例之node debugger + node inspector

@CarlosRen 这种打log的调试还是有点low,哈哈

@CarlosRen 恩恩,学到了

@i5ting 谢谢大神

@hellopao 哈哈,老司机

异步的我喜欢console… 顺便vscode调试杠杠的

webstorm 有点重不喜欢。nodejs项目用vscode(因为调试很方便),其他用sublime。

回到顶部