Skip to content
Browse files

Merge branch 'master' of https://github.com/dsn/log4js-node into dsn-…

…master
  • Loading branch information...
2 parents 107e33c + e58cf20 commit 73437ecb40fc39b298c43458ce7ba96a8b1c0c1d Gareth Jones committed Apr 2, 2013
Showing with 19 additions and 20 deletions.
  1. +19 −20 lib/appenders/multiprocess.js
View
39 lib/appenders/multiprocess.js
@@ -38,31 +38,30 @@ function logServer(config) {
var actualAppender = config.actualAppender,
server = net.createServer(function serverCreated(clientSocket) {
clientSocket.setEncoding('utf8');
- clientSocket.on('connect', function clientConnected() {
- var logMessage = '';
+ var logMessage = '';
- function logTheMessage(msg) {
- if (logMessage.length > 0) {
- actualAppender(deserializeLoggingEvent(clientSocket, msg));
- }
+ function logTheMessage(msg) {
+ if (logMessage.length > 0) {
+ actualAppender(deserializeLoggingEvent(clientSocket, msg));
}
-
- function chunkReceived(chunk) {
- var event;
- logMessage += chunk || '';
- if (logMessage.indexOf(END_MSG) > -1) {
- event = logMessage.substring(0, logMessage.indexOf(END_MSG));
- logTheMessage(event);
- logMessage = logMessage.substring(event.length + END_MSG.length) || '';
- //check for more, maybe it was a big chunk
- chunkReceived();
- }
+ }
+
+ function chunkReceived(chunk) {
+ var event;
+ logMessage += chunk || '';
+ if (logMessage.indexOf(END_MSG) > -1) {
+ event = logMessage.substring(0, logMessage.indexOf(END_MSG));
+ logTheMessage(event);
+ logMessage = logMessage.substring(event.length + END_MSG.length) || '';
+ //check for more, maybe it was a big chunk
+ chunkReceived();
}
+ }
- clientSocket.on('data', chunkReceived);
- clientSocket.on('end', chunkReceived);
- });
+ clientSocket.on('data', chunkReceived);
+ clientSocket.on('end', chunkReceived);
});
+
server.listen(config.loggerPort || 5000, config.loggerHost || 'localhost');
return actualAppender;

0 comments on commit 73437ec

Please sign in to comment.
Something went wrong with that request. Please try again.