console.dir(response)
var inspect = require('util').inspect; console.log(inspect(response))
目前我测试是差不多的,不知道它们有啥差别,求指教
Console.prototype.dir = function(object, options) { this._stdout.write(util.inspect(object, util._extend({ customInspect: false }, options)) + ‘\n’); };
Console.prototype.log = function() { this._stdout.write(util.format.apply(this, arguments) + ‘\n’); };
@MiguelValentine 谢谢阿,瞬间就懂了
@MiguelValentine @i5ting 看来还是看源码的牛逼啊。。 util.inspect 还有个
util.inspect
showHidden - if true then the object’s non-enumerable properties will be shown too. Defaults to false.
选项。 有时候会有用。
https://github.com/joyent/node/blob/master/lib/console.js#L70
CNode 社区为国内最专业的 Node.js 开源技术社区,致力于 Node.js 的技术研究。
Console.prototype.dir = function(object, options) { this._stdout.write(util.inspect(object, util._extend({ customInspect: false }, options)) + ‘\n’); };
Console.prototype.log = function() { this._stdout.write(util.format.apply(this, arguments) + ‘\n’); };
@MiguelValentine 谢谢阿,瞬间就懂了
@MiguelValentine @i5ting 看来还是看源码的牛逼啊。。
util.inspect还有个选项。 有时候会有用。
https://github.com/joyent/node/blob/master/lib/console.js#L70