console.js 470 B

12345678910111213141516171819
  1. 'use strict';
  2. const consoleLog = console.log.bind(console);
  3. function consoleAppender(layout, timezoneOffset) {
  4. return (loggingEvent) => {
  5. consoleLog(layout(loggingEvent, timezoneOffset));
  6. };
  7. }
  8. function configure(config, layouts) {
  9. let layout = layouts.colouredLayout;
  10. if (config.layout) {
  11. layout = layouts.layout(config.layout.type, config.layout);
  12. }
  13. return consoleAppender(layout, config.timezoneOffset);
  14. }
  15. module.exports.configure = configure;