CNode

nodejs 调试

问答
Ddogsmall发布于10 年前最后回复10 年前9 回复6588 浏览0 收藏

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)

H
hellopao#1·10 年前

等会i5ting就会来推荐vs code

C
CarlosRen#2·10 年前
var yourFunction = function () {};
yourFunction.prototype.debug = function(s){
	console.log('srcServer'+s)
}

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

I
i5ting#4·10 年前
引用 CarlosRen我觉得是这个意思,在server上加一个debug函数,跟IDE没啥关系

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

D
dogsmall#7·10 年前
引用 hellopao等会i5ting就会来推荐vs code了

@hellopao 哈哈,老司机

G
gjc9620#8·10 年前

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

G
giscafer#9·10 年前

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

参与回复
登录后即可参与回复。登录