console.js 494 B

123456789101112131415161718
  1. // eslint-disable-next-line no-console
  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;