How to use the winston-transport.call function in winston-transport

To help you get started, we’ve selected a few winston-transport examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github satoripop / thesuperlogger / src / transports / winston-mail.js View on Github external
let Mail = exports.Mail = function(options) {
  options = options || {}
  Transport.call(this, options);

  if (!options.to) {
    throw new Error("super-logger(winston-email) requires 'to' property")
  }

  if (!options.transportOptions) {
    throw new Error("super-logger(winston-email) requires 'transportOptions'")
  }

  this.to = options.to;
  this.from = options.from || 'super-logger@' + os.hostname();
  this.subject = options.subject || '';
  this.html = options.html || false; // Send mail in html format
  this.formatter = options.formatter || false;
  this.level = options.level;
github satoripop / thesuperlogger / src / transports / winston-console.js View on Github external
var Console = module.exports = function (options) {
	options = options || {};
	TransportStream.call(this, options);
	this.stderrLevels = getStderrLevels(options.stderrLevels, options.debugStdout);
	this.eol = os.EOL;

	//
	// Convert stderrLevels into an Object for faster key-lookup times than an Array.
	//
	// For backwards compatibility, stderrLevels defaults to ['error', 'debug']
	// or ['error'] depending on whether options.debugStdout is true.
	//
	function getStderrLevels(levels, debugStdout) {
		var defaultMsg = 'Cannot have non-string elements in stderrLevels Array';
		if (debugStdout) {
			if (levels) {
				//
				// Don't allow setting both debugStdout and stderrLevels together,
				// since this could cause behaviour a programmer might not expect.
github winstonjs / winston-daily-rotate-file / daily-rotate-file.js View on Github external
var DailyRotateFile = function (options) {
    options = options || {};
    Transport.call(this, options);

    function throwIf(target /* , illegal... */) {
        Array.prototype.slice.call(arguments, 1).forEach(function (name) {
            if (options[name]) {
                throw new Error('Cannot set ' + name + ' and ' + target + ' together');
            }
        });
    }

    function getMaxSize(size) {
        if (size && typeof size === 'string') {
            var _s = size.toLowerCase().match(/^((?:0\.)?\d+)([k|m|g])$/);
            if (_s) {
                return size;
            }
        } else if (size && Number.isInteger(size)) {
github satoripop / thesuperlogger / src / transports / winston-mongodb.js View on Github external
let MongoDB = exports.MongoDB = function(options) {
	Transport.call(this, options);
	options = (options || {});
	if (!options.db) {
		throw new Error('You should provide db to log to.');
	}
	this.on('error', (err) => {
		console.error('super-logger(winston-mongodb), error on logging in database: ', err);
	});
	this.name = options.name || 'mongodb';
	this.db = options.db;
	this.options = options.options;
	if (!this.options) {
		this.options = {
			poolSize: 2,
			autoReconnect: true,
		};
	}
github winstonjs / winston-mongodb / lib / winston-mongodb.js View on Github external
let MongoDB = exports.MongoDB = function(options) {
  Transport.call(this, options);
  options = (options || {});
  if (!options.db) {
    throw new Error('You should provide db to log to.');
  }
  this.name = options.name || 'mongodb';
  this.db = options.db;
  this.options = options.options;
  if (!this.options) {
    this.options = {
      poolSize: 2,
      autoReconnect: true,
      useNewUrlParser: true
    };
  }
  this.collection = (options.collection || 'log');
  this.level = (options.level || 'info');

winston-transport

Base stream implementations for winston@3 and up.

MIT
Latest version published 1 month ago

Package Health Score

89 / 100
Full package analysis