Logging and Debugging

Logging and Debugging

Socket.IO is now completely instrumented by a minimalistic yet tremendously powerful utility called debug by TJ Holowaychuk.

Before 1.0, the Socket.IO server would default to logging everything out to the console. This turned out to be annoyingly verbose for many users (although extremely useful for others), so now we default to being completely silent by default.

The basic idea is that each module used by Socket.IO provides different debugging scopes that give you insight into the internals. By default, all output is suppressed, and you can opt into seeing messages by supplying the DEBUG env variable (Node.JS) or the localStorage.debug property (Browsers).

You can see it in action for example on our homepage:

Available debugging scopes

The best way to see what information is available is to use the *:

DEBUG=* node yourfile.js

or in the browser:

localStorage.debug = '*';

And then filter by the scopes you’re interested in. You can use , to separate them.

© 2014–2015 Automattic
Licensed under the MIT License.
http://socket.io/docs/logging-and-debugging

在线笔记
App下载
App下载

扫描二维码

下载编程狮App

公众号
微信公众号

编程狮公众号

意见反馈
返回顶部