2013-05-25 12:00:06 +08:00
|
|
|
"use strict";
|
|
|
|
var layouts = require('../layouts')
|
2013-07-10 20:07:28 +08:00
|
|
|
, consoleLog = console.log.bind(console);
|
2011-07-24 19:58:02 +08:00
|
|
|
|
|
|
|
function consoleAppender (layout) {
|
2013-05-25 12:00:06 +08:00
|
|
|
layout = layout || layouts.colouredLayout;
|
|
|
|
return function(loggingEvent) {
|
|
|
|
consoleLog(layout(loggingEvent));
|
|
|
|
};
|
2011-07-24 19:58:02 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
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);
|
2011-07-24 19:58:02 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
exports.appender = consoleAppender;
|
|
|
|
exports.configure = configure;
|