Skip to content

make lib compatible with log4js 3.x#10

Open
menshov-d wants to merge 1 commit intolitixsoft:masterfrom
menshov-d:master
Open

make lib compatible with log4js 3.x#10
menshov-d wants to merge 1 commit intolitixsoft:masterfrom
menshov-d:master

Conversation

@menshov-d
Copy link
Copy Markdown

@menshov-d menshov-d commented Mar 14, 2019

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 menshov-d closed this Mar 14, 2019
@menshov-d menshov-d reopened this Mar 14, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant