lib/index.js
function Transport(options) {
  if (!options) {
    options = { };
  }

  this.name = options.name || 'ecs-logs';
  this.level = options.level || 'debug';
  this.output = options.output || function(s) {
    process.stdout.write(s + '\n');
  };
  this.timestamp = options.timestamp || Date.now;
  this.formatter = options.formatter || new Formatter({
    hostname: options.hostname
  });
}
function Transport(options) {
  if (!options) {
    options = { };
  }

  this.name = options.name || 'ecs-logs';
  this.level = options.level || 'debug';
  this.output = options.output || function(s) {
    process.stdout.write(s + '\n');
  };
  this.timestamp = options.timestamp || Date.now;
  this.formatter = options.formatter || new Formatter({
    hostname: options.hostname
  });
}
function Transport ( options ) { if ( ! options ) { options = { } ; } this . name = options . name || 'ecs-logs' ; this . level = options . level || 'debug' ; this . output = options . output || function ( s ) { process . stdout . write ( s + '\n' ) ; } ; this . timestamp = options . timestamp || Date . now ; this . formatter = options . formatter || new Formatter ( { hostname : options . hostname } ) ; }
The Transport type implements a winston log transport preconfigured to
output log messages compatible with ecs-logs.

@example
var ecslogs = require('ecs-logs-js');
var winston = require('winston');

// Instantiate an ecs-logs compatible winston logger with ecslogs.Transport
var logger = new winston.Logger({
transports: [
new ecslogs.Transport()
]
});

@param {Object} [options] The configuration object for the new transport,
besides the properties documented here the options object can also carry all
properties that the Formatter constructor accepts, they will be passed to the
default formatter instantiated if none was given.

@param {string} [options.name] The transport name, defaults to 'ecs-logs'

@param {string} [options.level] The transport level, defaults to 'debug'
messages, this is passed to the default formatter if none was provided

@param {function} [options.output] A function called when the transport has
a log message to send, defaults to writing to stdout.

@param {function} [options.timestamp] A function returning timestamps,
defaults to Date.now

@param {Object} [options.formatter] A winston formatter, defaults to an
instance of Formatter
The Transport type implements a winston log transport preconfigured to output log messages compatible with ecs - logs .