log4js-node-mongodb icon indicating copy to clipboard operation
log4js-node-mongodb copied to clipboard

make lib compatible with log4js 3.x

Open menshov-d opened this issue 6 years ago • 0 comments

function insert(loggingEvent) { var options = getOptions(); var category; if (loggingEvent.hasOwnProperty('logger.category')) { category = loggingEvent.logger.category; } else { category = loggingEvent.categoryName; } if (collection) { if (options.w === 0) { // fast write collection.insert({ timestamp: loggingEvent.startTime, data: loggingEvent.data, level: loggingEvent.level, category: category },options); } else { // save write collection.insert({ timestamp: loggingEvent.startTime, data: loggingEvent.data, level: loggingEvent.level, category: category },options,function(error) { if (error) { console.error('log: Error writing data to log!'); console.error(error); console.log('log: Connection: %s, collection: %, data: %j',config.connectionString,collectionName,loggingEvent); } }); } } else { cache.push(loggingEvent); } }

menshov-d avatar Mar 14 '19 06:03 menshov-d