all files / pnr-common/lib/node/logging/ fluent-logger.js

100% Statements 6/6
100% Branches 0/0
100% Functions 0/0
100% Lines 5/5
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21                               
'use strict';
 
const winston = require( 'winston' );
require(__dirname + '/winston-fluent').Fluent; //jshint ignore: line
 
// remember to specify tag: and label: in custom
exports.fluentTransport = (config, custom) =>
   new winston.transports.Fluent(Object.assign({
      options: {
         host: config.fluentd.host,
         port: parseInt(config.fluentd.port, 10),
         timeout: parseInt(config.fluentd.socket_timeout_ms, 10),
         reconnectInterval: parseInt(config.fluentd.reconnect_interval_ms, 10)
      }
   }, custom));
 
exports.fluent = (config, custom) => new (winston.Logger)({
   transports: [exports.fluentTransport(config, custom)],
   exitOnError: false
});