# All files / lib/appenders stdout.js

77.78% Statements 7/9
75% Branches 3/4
66.67% Functions 2/3
77.78% Lines 7/9

    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22

    2x

    3x
    3x

    3x

    3x

    2x
    2x
     'use strict';

    const layouts = require('../layouts');

    function stdoutAppender(layout, timezoneOffset) {
      layout = layout || layouts.colouredLayout;
      return function (loggingEvent) {
        process.stdout.write(`${layout(loggingEvent, timezoneOffset)}\n`);
      };
    }

    function configure(config) {
      let layout;
      Iif (config.layout) {
        layout = layouts.layout(config.layout.type, config.layout);
      }
      return stdoutAppender(layout, config.timezoneOffset);
    }

    exports.appender = stdoutAppender;
    exports.configure = configure;