log4js-node/lib/appenders/console.js

22 lines
492 B
JavaScript
Raw Normal View History

2013-05-25 12:00:06 +08:00
"use strict";
var layouts = require('../layouts')
, consoleLog = console.log.bind(console);
function consoleAppender (layout) {
2013-05-25 12:00:06 +08:00
layout = layout || layouts.colouredLayout;
return function(loggingEvent) {
consoleLog(layout(loggingEvent));
};
}
function configure(config) {
2013-05-25 12:00:06 +08:00
var layout;
if (config.layout) {
layout = layouts.layout(config.layout.type, config.layout);
}
return consoleAppender(layout);
}
exports.appender = consoleAppender;
exports.configure = configure;