Skip to content

Commit

Permalink
refactor(logger): Remove unused socket.io logger
Browse files Browse the repository at this point in the history
  • Loading branch information
dignifiedquire committed May 27, 2015
1 parent ce912bf commit d793b25
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 25 deletions.
23 changes: 4 additions & 19 deletions lib/logger.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,17 +9,6 @@ var log4js = require('log4js');
var helper = require('./helper');
var constant = require('./constants');

// Special Wrapper for Socket.io :(
var LogWrapper = function(name, level) {
this.logger = log4js.getLogger(name);
this.logger.setLevel(level);
};
['error', 'warn', 'info', 'debug'].forEach(function(level) {
LogWrapper.prototype[level] = function() {
this.logger[level].apply(this.logger, arguments);
};
});

// #### Public Functions

// Setup the logger by passing in the configuration options. It needs
Expand Down Expand Up @@ -61,15 +50,11 @@ var setup = function(level, colors, appenders) {
// to be used as a logger for socket.io.
// * `level`, which defaults to the global level.
var create = function(name, level) {
if (name === 'socket.io') {
return new LogWrapper('socket.io', level);
} else {
var logger = log4js.getLogger(name || 'karma');
if (helper.isDefined(level)) {
logger.setLevel(level);
}
return logger;
var logger = log4js.getLogger(name || 'karma');
if (helper.isDefined(level)) {
logger.setLevel(level);
}
return logger;
};


Expand Down
6 changes: 0 additions & 6 deletions lib/server.js
Original file line number Diff line number Diff line change
Expand Up @@ -258,12 +258,6 @@ var createSocketIoServer = function(webServer, executor, config) {
var server = new Server(webServer, {
// avoid destroying http upgrades from socket.io to get proxied websockets working
destroyUpgrade: false,
// socket.io has a timeout (15s by default) before destroying a store (a data structure where
// data associated with a socket are stored). Unfortunately this timeout is not cleared
// properly on socket.io shutdown and this timeout prevents karma from exiting cleanly.
// We change this timeout to 0 to make Karma exit just after all tests were executed.
//'client store expiration': 0,
logger: logger.create('socket.io', constant.LOG_ERROR),
path: config.urlRoot + 'socket.io/',
transports: config.transports
});
Expand Down

0 comments on commit d793b25

Please sign in to comment.