stderr.js 438 B

1234567891011121314151617
  1. 'use strict';
  2. function stderrAppender(layout, timezoneOffset) {
  3. return (loggingEvent) => {
  4. process.stderr.write(`${layout(loggingEvent, timezoneOffset)}\n`);
  5. };
  6. }
  7. function configure(config, layouts) {
  8. let layout = layouts.colouredLayout;
  9. if (config.layout) {
  10. layout = layouts.layout(config.layout.type, config.layout);
  11. }
  12. return stderrAppender(layout, config.timezoneOffset);
  13. }
  14. module.exports.configure = configure;