22 lines
547 B
JavaScript
22 lines
547 B
JavaScript
|
"use strict";
|
||
|
var layouts = require('../layouts')
|
||
|
, consoleLog = console.log.bind(console);
|
||
|
|
||
|
function consoleAppender (layout, timezoneOffset) {
|
||
|
layout = layout || layouts.colouredLayout;
|
||
|
return function(loggingEvent) {
|
||
|
consoleLog(layout(loggingEvent, timezoneOffset));
|
||
|
};
|
||
|
}
|
||
|
|
||
|
function configure(config) {
|
||
|
var layout;
|
||
|
if (config.layout) {
|
||
|
layout = layouts.layout(config.layout.type, config.layout);
|
||
|
}
|
||
|
return consoleAppender(layout, config.timezoneOffset);
|
||
|
}
|
||
|
|
||
|
exports.appender = consoleAppender;
|
||
|
exports.configure = configure;
|