mardi 3 mars 2015

can't log requests when socket.io enabled

I'm trying to debug a socket.io problem. In order to figure out what's happening, I'd like to log all requests, so I have installed morgan.



var express = require('express');
var app = express();
app.use(require('morgan')('dev'));
var path = require('path');
var http = require('http').Server(app);
var io = require('socket.io')(http); // this line prevents morgan from logging


Logging works fine until I require socket.io- that last line there apparently prevents morgan from seeing all the requests.


Why is socket.io preventing the rest of the stack from seeing requests?


Edit:


Something of an explanation here: apparently socket.io is too verbose, and debugging is turned off by default. If I run with DEBUG=* set in my environment, I get lots more information.


This does seem rather unfriendly to the rest of the stack though.


Aucun commentaire:

Enregistrer un commentaire