Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

fix for issue #100, multiprocess appender and logLevelFilter don't pl…

…ay nicely
  • Loading branch information...
commit a9307fd6dababf8a4dbd7e8317c7fd64b57ce16e 1 parent 4739c65
@nomiddlename authored
View
13 lib/appenders/multiprocess.js
@@ -16,20 +16,15 @@ function logServer(config) {
function deserializeLoggingEvent(clientSocket, msg) {
var loggingEvent;
try {
- loggingEvent = JSON.parse(msg);
- loggingEvent.startTime = new Date(loggingEvent.startTime);
- loggingEvent.level.toString = function levelToString() {
- return loggingEvent.level.levelStr;
- };
+ loggingEvent = JSON.parse(msg);
+ loggingEvent.startTime = new Date(loggingEvent.startTime);
+ loggingEvent.level = log4js.levels.toLevel(loggingEvent.level.levelStr);
} catch (e) {
// JSON.parse failed, just log the contents probably a naughty.
loggingEvent = {
startTime: new Date(),
categoryName: 'log4js',
- level: { toString: function () {
- return 'ERROR';
- }
- },
+ level: log4js.levels.ERROR,
data: [ 'Unable to parse log:', msg ]
};
}
View
2  package.json
@@ -1,6 +1,6 @@
{
"name": "log4js",
- "version": "0.5.4",
+ "version": "0.5.5",
"description": "Port of Log4js to work with node.",
"keywords": [
"logging",
View
6 test/multiprocess-test.js
@@ -181,14 +181,14 @@ vows.describe('Multiprocess Appender').addBatch({
},
'when a client connects': {
topic: function(net) {
- var logString = JSON.stringify({ level: 'DEBUG', data: ['some debug']}) + '__LOG4JS__';
+ var logString = JSON.stringify({ level: { level: 10000, levelStr: 'DEBUG' }, data: ['some debug']}) + '__LOG4JS__';
net.cbs['connect']();
- net.cbs['data'](JSON.stringify({ level: 'ERROR', data: ['an error message'] }) + '__LOG4JS__');
+ net.cbs['data'](JSON.stringify({ level: { level: 40000, levelStr: 'ERROR' }, data: ['an error message'] }) + '__LOG4JS__');
net.cbs['data'](logString.substring(0, 10));
net.cbs['data'](logString.substring(10));
net.cbs['data'](logString + logString + logString);
- net.cbs['end'](JSON.stringify({ level: 'FATAL', data: ["that's all folks"] }) + '__LOG4JS__');
+ net.cbs['end'](JSON.stringify({ level: { level: 50000, levelStr: 'FATAL' }, data: ["that's all folks"] }) + '__LOG4JS__');
net.cbs['data']('bad message__LOG4JS__');
return net;
},
Please sign in to comment.
Something went wrong with that request. Please try again.