Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

winston

Package Overview
Dependencies
Maintainers
8
Versions
88
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

winston - npm Package Compare versions

Comparing version 3.7.2 to 3.11.0

44

dist/winston.js

@@ -7,8 +7,9 @@ /**

*/
'use strict';
var logform = require('logform');
var _require = require('./winston/common'),
warn = _require.warn;
var _require = require('./winston/common'),
warn = _require.warn;
/**

@@ -18,4 +19,2 @@ * Expose version. Use `require` method for `webpack` support.

*/
exports.version = require('../package.json').version;

@@ -26,3 +25,2 @@ /**

*/
exports.transports = require('./winston/transports');

@@ -33,3 +31,2 @@ /**

*/
exports.config = require('./winston/config');

@@ -40,3 +37,2 @@ /**

*/
exports.addColors = logform.levels;

@@ -47,3 +43,2 @@ /**

*/
exports.format = logform.format;

@@ -54,9 +49,12 @@ /**

*/
exports.createLogger = require('./winston/create-logger');
/**
* Expose core Logging-related prototypes.
* @type {function}
*/
exports.Logger = require('./winston/logger');
/**
* Expose core Logging-related prototypes.
* @type {Object}
*/
exports.ExceptionHandler = require('./winston/exception-handler');

@@ -67,3 +65,2 @@ /**

*/
exports.RejectionHandler = require('./winston/rejection-handler');

@@ -74,3 +71,2 @@ /**

*/
exports.Container = require('./winston/container');

@@ -81,3 +77,2 @@ /**

*/
exports.Transport = require('winston-transport');

@@ -95,4 +90,4 @@ /**

*/
exports.loggers = new exports.Container();
exports.loggers = new exports.Container();
/**

@@ -106,5 +101,5 @@ * We create and expose a 'defaultLogger' so that the programmer may do the

*/
var defaultLogger = exports.createLogger();
var defaultLogger = exports.createLogger(); // Pass through the target methods onto `winston.
// Pass through the target methods onto `winston.
Object.keys(exports.config.npm.levels).concat(['log', 'query', 'stream', 'add', 'remove', 'clear', 'profile', 'startTimer', 'handleExceptions', 'unhandleExceptions', 'handleRejections', 'unhandleRejections', 'configure', 'child']).forEach(function (method) {

@@ -115,2 +110,3 @@ return exports[method] = function () {

});
/**

@@ -121,3 +117,2 @@ * Define getter / setter for the default logger level which need to be exposed

*/
Object.defineProperty(exports, 'level', {

@@ -131,2 +126,3 @@ get: function get() {

});
/**

@@ -137,3 +133,2 @@ * Define getter for `exceptions` which replaces `handleExceptions` and

*/
Object.defineProperty(exports, 'exceptions', {

@@ -144,2 +139,3 @@ get: function get() {

});
/**

@@ -150,3 +146,2 @@ * Define getters / setters for appropriate properties of the default logger

*/
['exitOnError'].forEach(function (prop) {

@@ -162,2 +157,3 @@ Object.defineProperty(exports, prop, {

});
/**

@@ -167,3 +163,2 @@ * The default transports and exceptionHandlers for the default winston logger.

*/
Object.defineProperty(exports, 'default', {

@@ -177,5 +172,6 @@ get: function get() {

}
}); // Have friendlier breakage notices for properties that were exposed by default
});
// Have friendlier breakage notices for properties that were exposed by default
// on winston < 3.0.
warn.deprecated(exports, 'setLevels');

@@ -185,4 +181,2 @@ warn.forFunctions(exports, 'useFormat', ['cli']);

warn.forFunctions(exports, 'deprecated', ['addRewriter', 'addFilter', 'clone', 'extend']);
warn.forProperties(exports, 'deprecated', ['emitErrs', 'levelLength']); // Throw a useful error when users attempt to run `new winston.Logger`.
warn.moved(exports, 'createLogger', 'Logger');
warn.forProperties(exports, 'deprecated', ['emitErrs', 'levelLength']);

@@ -7,6 +7,8 @@ /**

*/
'use strict';
var _require = require('util'),
format = _require.format;
format = _require.format;
/**

@@ -18,4 +20,2 @@ * Set of simple deprecation notices and a way to expose them for a set of

*/
exports.warn = {

@@ -37,14 +37,2 @@ deprecated: function deprecated(prop) {

},
moved: function moved(obj, movedTo, prop) {
function movedNotice() {
return function () {
throw new Error([format('winston.%s was moved in winston@3.0.0.', prop), format('Use a winston.%s instead.', movedTo)].join('\n'));
};
}
Object.defineProperty(obj, prop, {
get: movedNotice,
set: movedNotice
});
},
forProperties: function forProperties(obj, type, props) {

@@ -51,0 +39,0 @@ props.forEach(function (prop) {

@@ -7,8 +7,9 @@ /**

*/
'use strict';
var logform = require('logform');
var _require = require('triple-beam'),
configs = _require.configs;
var _require = require('triple-beam'),
configs = _require.configs;
/**

@@ -18,5 +19,4 @@ * Export config set for the CLI.

*/
exports.cli = logform.levels(configs.cli);
exports.cli = logform.levels(configs.cli);
/**

@@ -26,4 +26,4 @@ * Export config set for npm.

*/
exports.npm = logform.levels(configs.npm);
exports.npm = logform.levels(configs.npm);
/**

@@ -33,4 +33,4 @@ * Export config set for the syslog.

*/
exports.syslog = logform.levels(configs.syslog);
exports.syslog = logform.levels(configs.syslog);
/**

@@ -40,3 +40,2 @@ * Hoist addColors from logform where it was refactored into in winston@3.

*/
exports.addColors = logform.levels;

@@ -7,11 +7,13 @@ /**

*/
'use strict';
function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }
function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, _toPropertyKey(descriptor.key), descriptor); } }
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
function _toPrimitive(input, hint) { if (_typeof(input) !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (_typeof(res) !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
var createLogger = require('./create-logger');
var createLogger = require('./create-logger');
/**

@@ -21,4 +23,2 @@ * Inversion of control container for winston logger instances.

*/
module.exports = /*#__PURE__*/function () {

@@ -32,8 +32,7 @@ /**

var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
_classCallCheck(this, Container);
this.loggers = new Map();
this.options = options;
}
/**

@@ -46,4 +45,2 @@ * Retrieves a `winston.Logger` instance for the specified `id`. If an

*/
_createClass(Container, [{

@@ -53,3 +50,2 @@ key: "add",

var _this = this;
if (!this.loggers.has(id)) {

@@ -59,6 +55,11 @@ // Remark: Simple shallow clone for configuration options in case we pass

options = Object.assign({}, options || this.options);
var existing = options.transports || this.options.transports; // Remark: Make sure if we have an array of transports we slice it to
var existing = options.transports || this.options.transports;
// Remark: Make sure if we have an array of transports we slice it to
// make copies of those references.
options.transports = existing ? existing.slice() : [];
if (existing) {
options.transports = Array.isArray(existing) ? existing.slice() : [existing];
} else {
options.transports = [];
}
var logger = createLogger(options);

@@ -70,5 +71,5 @@ logger.on('close', function () {

}
return this.loggers.get(id);
}
/**

@@ -81,3 +82,2 @@ * Retreives a `winston.Logger` instance for the specified `id`. If

*/
}, {

@@ -88,2 +88,3 @@ key: "get",

}
/**

@@ -95,3 +96,2 @@ * Check if the container has a logger with the id.

*/
}, {

@@ -102,2 +102,3 @@ key: "has",

}
/**

@@ -109,3 +110,2 @@ * Closes a `Logger` instance with the specified `id` if it exists.

*/
}, {

@@ -115,7 +115,5 @@ key: "close",

var _this2 = this;
if (id) {
return this._removeLogger(id);
}
this.loggers.forEach(function (val, key) {

@@ -125,2 +123,3 @@ return _this2._removeLogger(key);

}
/**

@@ -132,3 +131,2 @@ * Remove a logger based on the id.

*/
}, {

@@ -140,8 +138,7 @@ key: "_removeLogger",

}
var logger = this.loggers.get(id);
logger.close();
this._delete(id);
}
/**

@@ -154,3 +151,2 @@ * Deletes a `Logger` instance with the specified `id`.

*/
}, {

@@ -162,4 +158,3 @@ key: "_delete",

}]);
return Container;
}();

@@ -7,38 +7,27 @@ /**

*/
'use strict';
function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }
function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, _toPropertyKey(descriptor.key), descriptor); } }
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
function _toPrimitive(input, hint) { if (_typeof(input) !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (_typeof(res) !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); Object.defineProperty(subClass, "prototype", { writable: false }); if (superClass) _setPrototypeOf(subClass, superClass); }
function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } else if (call !== void 0) { throw new TypeError("Derived constructors may only return object or undefined"); } return _assertThisInitialized(self); }
function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
var _require = require('triple-beam'),
LEVEL = _require.LEVEL;
LEVEL = _require.LEVEL;
var config = require('./config');
var Logger = require('./logger');
var debug = require('@dabh/diagnostics')('winston:create-logger');
function isLevelEnabledFunctionName(level) {
return 'is' + level.charAt(0).toUpperCase() + level.slice(1) + 'Enabled';
}
/**

@@ -50,4 +39,2 @@ * Create a new instance of a winston Logger. Creates a new

*/
module.exports = function () {

@@ -59,2 +46,3 @@ var opts = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};

opts.levels = opts.levels || config.npm.levels;
/**

@@ -65,8 +53,5 @@ * DerivedLogger to attach the logs level methods.

*/
var DerivedLogger = /*#__PURE__*/function (_Logger) {
_inherits(DerivedLogger, _Logger);
var _super = _createSuper(DerivedLogger);
/**

@@ -80,16 +65,13 @@ * Create a new class derived logger for which the levels can be attached to

_classCallCheck(this, DerivedLogger);
return _super.call(this, options);
}
return _createClass(DerivedLogger);
}(Logger);
var logger = new DerivedLogger(opts);
var logger = new DerivedLogger(opts); //
//
// Create the log level methods for the derived logger.
//
Object.keys(opts.levels).forEach(function (level) {
debug('Define prototype method for "%s"', level);
if (level === 'log') {

@@ -99,3 +81,5 @@ // eslint-disable-next-line no-console

return;
} //
}
//
// Define prototype methods for each log level e.g.:

@@ -110,12 +94,10 @@ // logger.log('info', msg) implies these methods are defined:

//
DerivedLogger.prototype[level] = function () {
// Prefer any instance scope, but default to "root" logger
var self = this || logger; // Optimize the hot-path which is the single object.
var self = this || logger;
// Optimize the hot-path which is the single object.
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
args[_key] = arguments[_key];
}
if (args.length === 1) {

@@ -127,22 +109,19 @@ var msg = args[0];

info.level = info[LEVEL] = level;
self._addDefaultMeta(info);
self.write(info);
return this || logger;
} // When provided nothing assume the empty string
}
// When provided nothing assume the empty string
if (args.length === 0) {
self.log(level, '');
return self;
} // Otherwise build argument list which could potentially conform to
}
// Otherwise build argument list which could potentially conform to
// either:
// . v3 API: log(obj)
// 2. v1/v2 API: log(level, msg, ... [string interpolate], [{metadata}], [callback])
return self.log.apply(self, [level].concat(args));
};
DerivedLogger.prototype[isLevelEnabledFunctionName(level)] = function () {

@@ -149,0 +128,0 @@ return (this || logger).isLevelEnabled(level);

@@ -7,21 +7,18 @@ /**

*/
'use strict';
function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }
function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, _toPropertyKey(descriptor.key), descriptor); } }
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
function _toPrimitive(input, hint) { if (_typeof(input) !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (_typeof(res) !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
var os = require('os');
var asyncForEach = require('async/forEach');
var debug = require('@dabh/diagnostics')('winston:exception');
var once = require('one-time');
var stackTrace = require('stack-trace');
var ExceptionStream = require('./exception-stream');
var ExceptionStream = require('./exception-stream');
/**

@@ -31,4 +28,2 @@ * Object for handling uncaughtException events.

*/
module.exports = /*#__PURE__*/function () {

@@ -41,10 +36,9 @@ /**

_classCallCheck(this, ExceptionHandler);
if (!logger) {
throw new Error('Logger is required to handle exceptions');
}
this.logger = logger;
this.handlers = new Map();
}
/**

@@ -55,4 +49,2 @@ * Handles `uncaughtException` events for the current process by adding any

*/
_createClass(ExceptionHandler, [{

@@ -62,7 +54,5 @@ key: "handle",

var _this = this;
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
args[_key] = arguments[_key];
}
args.forEach(function (arg) {

@@ -74,6 +64,4 @@ if (Array.isArray(arg)) {

}
_this._addHandler(arg);
});
if (!this.catcher) {

@@ -84,2 +72,3 @@ this.catcher = this._uncaughtException.bind(this);

}
/**

@@ -90,3 +79,2 @@ * Removes any handlers to `uncaughtException` events for the current

*/
}, {

@@ -96,3 +84,2 @@ key: "unhandle",

var _this2 = this;
if (this.catcher) {

@@ -106,2 +93,3 @@ process.removeListener('uncaughtException', this.catcher);

}
/**

@@ -112,12 +100,9 @@ * TODO: add method description

*/
}, {
key: "getAllInfo",
value: function getAllInfo(err) {
var message = err.message;
if (!message && typeof err === 'string') {
message = err;
var message = null;
if (err) {
message = typeof err === 'string' ? err : err.message;
}
return {

@@ -127,4 +112,4 @@ error: err,

level: 'error',
message: ["uncaughtException: ".concat(message || '(no error message)'), err.stack || ' No stack trace'].join('\n'),
stack: err.stack,
message: ["uncaughtException: ".concat(message || '(no error message)'), err && err.stack || ' No stack trace'].join('\n'),
stack: err && err.stack,
exception: true,

@@ -137,2 +122,3 @@ date: new Date().toString(),

}
/**

@@ -142,3 +128,2 @@ * Gets all relevant process information for the currently running process.

*/
}, {

@@ -158,2 +143,3 @@ key: "getProcessInfo",

}
/**

@@ -163,3 +149,2 @@ * Gets all relevant OS information for the currently running process.

*/
}, {

@@ -173,2 +158,3 @@ key: "getOsInfo",

}
/**

@@ -179,3 +165,2 @@ * Gets a stack trace for the specified error.

*/
}, {

@@ -196,2 +181,3 @@ key: "getTrace",

}
/**

@@ -202,3 +188,2 @@ * Helper method to add a transport as an exception handler.

*/
}, {

@@ -214,2 +199,3 @@ key: "_addHandler",

}
/**

@@ -222,3 +208,2 @@ * Logs all relevant information around the `err` and exits the current

*/
}, {

@@ -228,21 +213,16 @@ key: "_uncaughtException",

var info = this.getAllInfo(err);
var handlers = this._getExceptionHandlers(); // Calculate if we should exit on this error
var handlers = this._getExceptionHandlers();
// Calculate if we should exit on this error
var doExit = typeof this.logger.exitOnError === 'function' ? this.logger.exitOnError(err) : this.logger.exitOnError;
var timeout;
if (!handlers.length && doExit) {
// eslint-disable-next-line no-console
console.warn('winston: exitOnError cannot be true with no exception handlers.'); // eslint-disable-next-line no-console
console.warn('winston: exitOnError cannot be true with no exception handlers.');
// eslint-disable-next-line no-console
console.warn('winston: not exiting process.');
doExit = false;
}
function gracefulExit() {
debug('doExit', doExit);
debug('process._exiting', process._exiting);
if (doExit && !process._exiting) {

@@ -253,18 +233,17 @@ // Remark: Currently ignoring any exceptions from transports when

clearTimeout(timeout);
} // eslint-disable-next-line no-process-exit
}
// eslint-disable-next-line no-process-exit
process.exit(1);
}
}
if (!handlers || handlers.length === 0) {
return process.nextTick(gracefulExit);
} // Log to all transports attempting to listen for when they are completed.
}
// Log to all transports attempting to listen for when they are completed.
asyncForEach(handlers, function (handler, next) {
var done = once(next);
var transport = handler.transport || handler; // Debug wrapping so that we can inspect what's going on under the covers.
var transport = handler.transport || handler;
// Debug wrapping so that we can inspect what's going on under the covers.
function onDone(event) {

@@ -276,3 +255,2 @@ return function () {

}
transport._ending = true;

@@ -284,5 +262,6 @@ transport.once('finish', onDone('finished'));

});
this.logger.log(info); // If exitOnError is true, then only allow the logging of exceptions to
this.logger.log(info);
// If exitOnError is true, then only allow the logging of exceptions to
// take up to `3000ms`.
if (doExit) {

@@ -292,2 +271,3 @@ timeout = setTimeout(gracefulExit, 3000);

}
/**

@@ -299,3 +279,2 @@ * Returns the list of transports and exceptionHandlers for this instance.

*/
}, {

@@ -314,4 +293,3 @@ key: "_getExceptionHandlers",

}]);
return ExceptionHandler;
}();

@@ -7,28 +7,21 @@ /**

*/
'use strict';
function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }
function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, _toPropertyKey(descriptor.key), descriptor); } }
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
function _toPrimitive(input, hint) { if (_typeof(input) !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (_typeof(res) !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); Object.defineProperty(subClass, "prototype", { writable: false }); if (superClass) _setPrototypeOf(subClass, superClass); }
function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } else if (call !== void 0) { throw new TypeError("Derived constructors may only return object or undefined"); } return _assertThisInitialized(self); }
function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
var _require = require('readable-stream'),
Writable = _require.Writable;
function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
var _require = require('readable-stream'),
Writable = _require.Writable;
/**

@@ -39,9 +32,5 @@ * TODO: add class description.

*/
module.exports = /*#__PURE__*/function (_Writable) {
_inherits(ExceptionStream, _Writable);
var _super = _createSuper(ExceptionStream);
/**

@@ -55,15 +44,12 @@ * Constructor function for the ExceptionStream responsible for wrapping a

var _this;
_classCallCheck(this, ExceptionStream);
_this = _super.call(this, {
objectMode: true
});
if (!transport) {
throw new Error('ExceptionStream requires a TransportStream instance.');
} // Remark (indexzero): we set `handleExceptions` here because it's the
}
// Remark (indexzero): we set `handleExceptions` here because it's the
// predicate checked in ExceptionHandler.prototype.__getExceptionHandlers
_this.handleExceptions = true;

@@ -73,2 +59,3 @@ _this.transport = transport;

}
/**

@@ -83,4 +70,2 @@ * Writes the info object to our transport instance if (and only if) the

*/
_createClass(ExceptionStream, [{

@@ -92,3 +77,2 @@ key: "_write",

}
callback();

@@ -98,4 +82,3 @@ return true;

}]);
return ExceptionStream;
}(Writable);

@@ -7,52 +7,35 @@ /**

*/
'use strict';
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }
function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, _toPropertyKey(descriptor.key), descriptor); } }
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
function _toPrimitive(input, hint) { if (_typeof(input) !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (_typeof(res) !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); Object.defineProperty(subClass, "prototype", { writable: false }); if (superClass) _setPrototypeOf(subClass, superClass); }
function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } else if (call !== void 0) { throw new TypeError("Derived constructors may only return object or undefined"); } return _assertThisInitialized(self); }
function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
var _require = require('readable-stream'),
Stream = _require.Stream,
Transform = _require.Transform;
Stream = _require.Stream,
Transform = _require.Transform;
var asyncForEach = require('async/forEach');
var _require2 = require('triple-beam'),
LEVEL = _require2.LEVEL,
SPLAT = _require2.SPLAT;
LEVEL = _require2.LEVEL,
SPLAT = _require2.SPLAT;
var isStream = require('is-stream');
var ExceptionHandler = require('./exception-handler');
var RejectionHandler = require('./rejection-handler');
var LegacyTransportStream = require('winston-transport/legacy');
var Profiler = require('./profiler');
var _require3 = require('./common'),
warn = _require3.warn;
warn = _require3.warn;
var config = require('./config');
var config = require('./config');
/**

@@ -64,5 +47,4 @@ * Captures the number of format (i.e. %s strings) in a given string.

*/
var formatRegExp = /%[scdjifoO%]/g;
var formatRegExp = /%[scdjifoO%]/g;
/**

@@ -73,8 +55,5 @@ * TODO: add class description.

*/
var Logger = /*#__PURE__*/function (_Transform) {
_inherits(Logger, _Transform);
var _super = _createSuper(Logger);
/**

@@ -87,14 +66,9 @@ * Constructor function for the Logger object responsible for persisting log

var _this;
_classCallCheck(this, Logger);
_this = _super.call(this, {
objectMode: true
});
_this.configure(options);
return _this;
}
_createClass(Logger, [{

@@ -107,3 +81,5 @@ key: "child",

value: function value(info) {
var infoClone = Object.assign({}, defaultRequestMetadata, info); // Object.assign doesn't copy inherited Error
var infoClone = Object.assign({}, defaultRequestMetadata, info);
// Object.assign doesn't copy inherited Error
// properties so we have to do that explicitly

@@ -114,3 +90,2 @@ //

//
if (info instanceof Error) {

@@ -120,3 +95,2 @@ infoClone.stack = info.stack;

}
logger.write(infoClone);

@@ -127,2 +101,3 @@ }

}
/**

@@ -136,3 +111,2 @@ * This will wholesale reconfigure this instance by:

*/
}, {

@@ -142,22 +116,20 @@ key: "configure",

var _this2 = this;
var _ref = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {},
silent = _ref.silent,
format = _ref.format,
defaultMeta = _ref.defaultMeta,
levels = _ref.levels,
_ref$level = _ref.level,
level = _ref$level === void 0 ? 'info' : _ref$level,
_ref$exitOnError = _ref.exitOnError,
exitOnError = _ref$exitOnError === void 0 ? true : _ref$exitOnError,
transports = _ref.transports,
colors = _ref.colors,
emitErrs = _ref.emitErrs,
formatters = _ref.formatters,
padLevels = _ref.padLevels,
rewriters = _ref.rewriters,
stripColors = _ref.stripColors,
exceptionHandlers = _ref.exceptionHandlers,
rejectionHandlers = _ref.rejectionHandlers;
silent = _ref.silent,
format = _ref.format,
defaultMeta = _ref.defaultMeta,
levels = _ref.levels,
_ref$level = _ref.level,
level = _ref$level === void 0 ? 'info' : _ref$level,
_ref$exitOnError = _ref.exitOnError,
exitOnError = _ref$exitOnError === void 0 ? true : _ref$exitOnError,
transports = _ref.transports,
colors = _ref.colors,
emitErrs = _ref.emitErrs,
formatters = _ref.formatters,
padLevels = _ref.padLevels,
rewriters = _ref.rewriters,
stripColors = _ref.stripColors,
exceptionHandlers = _ref.exceptionHandlers,
rejectionHandlers = _ref.rejectionHandlers;
// Reset transports if we already have them

@@ -167,23 +139,20 @@ if (this.transports.length) {

}
this.silent = silent;
this.format = format || this.format || require('logform/json')();
this.defaultMeta = defaultMeta || null; // Hoist other options onto this instance.
this.defaultMeta = defaultMeta || null;
// Hoist other options onto this instance.
this.levels = levels || this.levels || config.npm.levels;
this.level = level;
if (this.exceptions) {
this.exceptions.unhandle();
}
if (this.rejections) {
this.rejections.unhandle();
}
this.exceptions = new ExceptionHandler(this);
this.rejections = new RejectionHandler(this);
this.profilers = {};
this.exitOnError = exitOnError; // Add all transports we have been provided.
this.exitOnError = exitOnError;
// Add all transports we have been provided.
if (transports) {

@@ -195,11 +164,8 @@ transports = Array.isArray(transports) ? transports : [transports];

}
if (colors || emitErrs || formatters || padLevels || rewriters || stripColors) {
throw new Error(['{ colors, emitErrs, formatters, padLevels, rewriters, stripColors } were removed in winston@3.0.0.', 'Use a custom winston.format(function) instead.', 'See: https://github.com/winstonjs/winston/tree/master/UPGRADE-3.0.md'].join('\n'));
}
if (exceptionHandlers) {
this.exceptions.handle(exceptionHandlers);
}
if (rejectionHandlers) {

@@ -213,26 +179,18 @@ this.rejections.handle(rejectionHandlers);

var _this3 = this;
var givenLevelValue = getLevelValue(this.levels, level);
if (givenLevelValue === null) {
return false;
}
var configuredLevelValue = getLevelValue(this.levels, this.level);
if (configuredLevelValue === null) {
return false;
}
if (!this.transports || this.transports.length === 0) {
return configuredLevelValue >= givenLevelValue;
}
var index = this.transports.findIndex(function (transport) {
var transportLevelValue = getLevelValue(_this3.levels, transport.level);
if (transportLevelValue === null) {
transportLevelValue = configuredLevelValue;
}
return transportLevelValue >= givenLevelValue;

@@ -242,4 +200,4 @@ });

}
/* eslint-disable valid-jsdoc */
/**

@@ -273,5 +231,3 @@ * Ensure backwards compatibility with a `log` method

*/
/* eslint-enable valid-jsdoc */
}, {

@@ -281,7 +237,5 @@ key: "log",

var _Object$assign2;
for (var _len = arguments.length, splat = new Array(_len > 2 ? _len - 2 : 0), _key = 2; _key < _len; _key++) {
splat[_key - 2] = arguments[_key];
}
// eslint-disable-line max-params

@@ -294,32 +248,22 @@ // Optimize for the hotpath of logging JSON literals

level[LEVEL] = level.level;
this._addDefaultMeta(level);
this.write(level);
return this;
} // Slightly less hotpath, but worth optimizing for.
}
// Slightly less hotpath, but worth optimizing for.
if (arguments.length === 2) {
var _msg;
if (msg && _typeof(msg) === 'object') {
msg[LEVEL] = msg.level = level;
this._addDefaultMeta(msg);
this.write(msg);
return this;
}
msg = (_msg = {}, _defineProperty(_msg, LEVEL, level), _defineProperty(_msg, "level", level), _defineProperty(_msg, "message", msg), _msg);
this._addDefaultMeta(msg);
this.write(msg);
return this;
}
var meta = splat[0];
if (_typeof(meta) === 'object' && meta !== null) {

@@ -329,6 +273,4 @@ // Extract tokens, if none available default to empty array to

var tokens = msg && msg.match && msg.match(formatRegExp);
if (!tokens) {
var _Object$assign;
var info = Object.assign({}, this.defaultMeta, meta, (_Object$assign = {}, _defineProperty(_Object$assign, LEVEL, level), _defineProperty(_Object$assign, SPLAT, splat), _defineProperty(_Object$assign, "level", level), _defineProperty(_Object$assign, "message", msg), _Object$assign));

@@ -341,6 +283,6 @@ if (meta.message) info.message = "".concat(info.message, " ").concat(meta.message);

}
this.write(Object.assign({}, this.defaultMeta, (_Object$assign2 = {}, _defineProperty(_Object$assign2, LEVEL, level), _defineProperty(_Object$assign2, SPLAT, splat), _defineProperty(_Object$assign2, "level", level), _defineProperty(_Object$assign2, "message", msg), _Object$assign2)));
return this;
}
/**

@@ -354,3 +296,2 @@ * Pushes data so that it can be picked up by all of our pipe targets.

*/
}, {

@@ -361,3 +302,5 @@ key: "_transform",

return callback();
} // [LEVEL] is only soft guaranteed to be set here since we are a proper
}
// [LEVEL] is only soft guaranteed to be set here since we are a proper
// stream. It is likely that `info` came in through `.log(info)` or

@@ -369,34 +312,33 @@ // `.info(info)`. If it is not defined, however, define it.

// - abstract-winston-transport
if (!info[LEVEL]) {
info[LEVEL] = info.level;
} // Remark: really not sure what to do here, but this has been reported as
}
// Remark: really not sure what to do here, but this has been reported as
// very confusing by pre winston@2.0.0 users as quite confusing when using
// custom levels.
if (!this.levels[info[LEVEL]] && this.levels[info[LEVEL]] !== 0) {
// eslint-disable-next-line no-console
console.error('[winston] Unknown logger level: %s', info[LEVEL]);
} // Remark: not sure if we should simply error here.
}
// Remark: not sure if we should simply error here.
if (!this._readableState.pipes) {
// eslint-disable-next-line no-console
console.error('[winston] Attempt to write logs with no transports %j', info);
} // Here we write to the `format` pipe-chain, which on `readable` above will
console.error('[winston] Attempt to write logs with no transports, which can increase memory usage: %j', info);
}
// Here we write to the `format` pipe-chain, which on `readable` above will
// push the formatted `info` Object onto the buffer for this instance. We trap
// (and re-throw) any errors generated by the user-provided format, but also
// guarantee that the streams callback is invoked so that we can continue flowing.
try {
this.push(this.format.transform(info, this.format.options));
} finally {
this._writableState.sync = false; // eslint-disable-next-line callback-return
this._writableState.sync = false;
// eslint-disable-next-line callback-return
callback();
}
}
/**

@@ -407,3 +349,2 @@ * Delays the 'finish' event until all transport pipe targets have

*/
}, {

@@ -419,2 +360,3 @@ key: "_final",

}
/**

@@ -425,3 +367,2 @@ * Adds the transport to this logger instance by piping to it.

*/
}, {

@@ -438,24 +379,19 @@ key: "add",

}) : transport;
if (!target._writableState || !target._writableState.objectMode) {
throw new Error('Transports must WritableStreams in objectMode. Set { objectMode: true }.');
} // Listen for the `error` event and the `warn` event on the new Transport.
}
// Listen for the `error` event and the `warn` event on the new Transport.
this._onEvent('error', target);
this._onEvent('warn', target);
this.pipe(target);
if (transport.handleExceptions) {
this.exceptions.handle();
}
if (transport.handleRejections) {
this.rejections.handle();
}
return this;
}
/**

@@ -466,3 +402,2 @@ * Removes the transport from this logger instance by unpiping from it.

*/
}, {

@@ -473,3 +408,2 @@ key: "remove",

var target = transport;
if (!isStream(transport) || transport.log.length > 2) {

@@ -480,9 +414,8 @@ target = this.transports.filter(function (match) {

}
if (target) {
this.unpipe(target);
}
return this;
}
/**

@@ -492,3 +425,2 @@ * Removes all transports from this logger instance.

*/
}, {

@@ -500,2 +432,3 @@ key: "clear",

}
/**

@@ -506,3 +439,2 @@ * Cleans up resources (streams, event listeners) for all transports

*/
}, {

@@ -517,2 +449,3 @@ key: "close",

}
/**

@@ -522,3 +455,2 @@ * Sets the `target` levels specified on this instance.

*/
}, {

@@ -529,2 +461,3 @@ key: "setLevels",

}
/**

@@ -537,3 +470,2 @@ * Queries the all transports for this instance with the specified `options`.

*/
}, {

@@ -546,7 +478,7 @@ key: "query",

}
options = options || {};
var results = {};
var queryObject = Object.assign({}, options.query || {}); // Helper function to query a single transport
var queryObject = Object.assign({}, options.query || {});
// Helper function to query a single transport
function queryTransport(transport, next) {

@@ -556,3 +488,2 @@ if (options.query && typeof transport.formatQuery === 'function') {

}
transport.query(options, function (err, res) {

@@ -562,13 +493,11 @@ if (err) {

}
if (typeof transport.formatResults === 'function') {
res = transport.formatResults(res, options.format);
}
next(null, res);
});
} // Helper function to accumulate the results from `queryTransport` into
}
// Helper function to accumulate the results from `queryTransport` into
// the `results`.
function addResults(transport, next) {

@@ -580,17 +509,15 @@ queryTransport(transport, function (err, result) {

result = err || result;
if (result) {
results[transport.name] = result;
} // eslint-disable-next-line callback-return
}
// eslint-disable-next-line callback-return
next();
}
next = null;
});
} // Iterate over the transports in parallel setting the appropriate key in
}
// Iterate over the transports in parallel setting the appropriate key in
// the `results`.
asyncForEach(this.transports.filter(function (transport) {

@@ -602,2 +529,3 @@ return !!transport.query;

}
/**

@@ -608,3 +536,2 @@ * Returns a log stream for all transports. Options object is optional.

*/
}, {

@@ -617,12 +544,10 @@ key: "stream",

out._streams = streams;
out.destroy = function () {
var i = streams.length;
while (i--) {
streams[i].destroy();
}
}; // Create a list of all transports for this instance.
};
// Create a list of all transports for this instance.
this.transports.filter(function (transport) {

@@ -632,7 +557,5 @@ return !!transport.stream;

var str = transport.stream(options);
if (!str) {
return;
}
streams.push(str);

@@ -652,2 +575,3 @@ str.on('log', function (log) {

}
/**

@@ -665,3 +589,2 @@ * Returns an object corresponding to a specific timing. When done is called

*/
}, {

@@ -672,2 +595,3 @@ key: "startTimer",

}
/**

@@ -680,3 +604,2 @@ * Tracks the time inbetween subsequent calls to this method with the same

*/
}, {

@@ -686,11 +609,10 @@ key: "profile",

var time = Date.now();
if (this.profilers[id]) {
var timeEnd = this.profilers[id];
delete this.profilers[id]; // Attempt to be kind to users if they are still using older APIs.
delete this.profilers[id];
// Attempt to be kind to users if they are still using older APIs.
for (var _len2 = arguments.length, args = new Array(_len2 > 1 ? _len2 - 1 : 0), _key2 = 1; _key2 < _len2; _key2++) {
args[_key2 - 1] = arguments[_key2];
}
if (typeof args[args.length - 2] === 'function') {

@@ -700,5 +622,5 @@ // eslint-disable-next-line no-console

args.pop();
} // Set the duration property of the metadata
}
// Set the duration property of the metadata
var info = _typeof(args[args.length - 1]) === 'object' ? args.pop() : {};

@@ -710,6 +632,6 @@ info.level = info.level || 'info';

}
this.profilers[id] = time;
return this;
}
/**

@@ -720,3 +642,2 @@ * Backwards compatibility to `exceptions.handle` in winston < 3.0.0.

*/
}, {

@@ -726,8 +647,7 @@ key: "handleExceptions",

var _this$exceptions;
// eslint-disable-next-line no-console
console.warn('Deprecated: .handleExceptions() will be removed in winston@4. Use .exceptions.handle()');
(_this$exceptions = this.exceptions).handle.apply(_this$exceptions, arguments);
}
/**

@@ -738,3 +658,2 @@ * Backwards compatibility to `exceptions.handle` in winston < 3.0.0.

*/
}, {

@@ -744,8 +663,7 @@ key: "unhandleExceptions",

var _this$exceptions2;
// eslint-disable-next-line no-console
console.warn('Deprecated: .unhandleExceptions() will be removed in winston@4. Use .exceptions.unhandle()');
(_this$exceptions2 = this.exceptions).unhandle.apply(_this$exceptions2, arguments);
}
/**

@@ -755,3 +673,2 @@ * Throw a more meaningful deprecation notice

*/
}, {

@@ -762,2 +679,3 @@ key: "cli",

}
/**

@@ -770,3 +688,2 @@ * Bubbles the `event` that occured on the specified `transport` up

*/
}, {

@@ -780,6 +697,4 @@ key: "_onEvent",

}
this.emit(event, err, transport);
}
if (!transport['__winston' + event]) {

@@ -798,15 +713,12 @@ transport['__winston' + event] = transportEvent.bind(this);

}]);
return Logger;
}(Transform);
function getLevelValue(levels, level) {
var value = levels[level];
if (!value && value !== 0) {
return null;
}
return value;
}
/**

@@ -816,4 +728,2 @@ * Represents the current readableState pipe targets for this Logger instance.

*/
Object.defineProperty(Logger.prototype, 'transports', {

@@ -820,0 +730,0 @@ configurable: false,

@@ -7,3 +7,5 @@ /**

*/
'use strict';
/**

@@ -14,12 +16,9 @@ * TODO: add class description.

*/
function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }
function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, _toPropertyKey(descriptor.key), descriptor); } }
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
module.exports = /*#__PURE__*/function () {
function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
function _toPrimitive(input, hint) { if (_typeof(input) !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (_typeof(res) !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
var Profiler = /*#__PURE__*/function () {
/**

@@ -34,10 +33,11 @@ * Constructor function for the Profiler instance used by

_classCallCheck(this, Profiler);
if (!logger) {
throw new Error('Logger is required for profiling.');
var Logger = require('./logger');
if (_typeof(logger) !== 'object' || Array.isArray(logger) || !(logger instanceof Logger)) {
throw new Error('Logger is required for profiling');
} else {
this.logger = logger;
this.start = Date.now();
}
}
this.logger = logger;
this.start = Date.now();
}
/**

@@ -49,4 +49,2 @@ * Ends the current timer (i.e. Profiler) instance and logs the `msg` along

*/
_createClass(Profiler, [{

@@ -58,3 +56,2 @@ key: "done",

}
if (typeof args[args.length - 1] === 'function') {

@@ -65,3 +62,2 @@ // eslint-disable-next-line no-console

}
var info = _typeof(args[args.length - 1]) === 'object' ? args.pop() : {};

@@ -73,4 +69,5 @@ info.level = info.level || 'info';

}]);
return Profiler;
}();
}();
;
module.exports = Profiler;

@@ -7,21 +7,18 @@ /**

*/
'use strict';
function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }
function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, _toPropertyKey(descriptor.key), descriptor); } }
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
function _toPrimitive(input, hint) { if (_typeof(input) !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (_typeof(res) !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
var os = require('os');
var asyncForEach = require('async/forEach');
var debug = require('@dabh/diagnostics')('winston:rejection');
var once = require('one-time');
var stackTrace = require('stack-trace');
var ExceptionStream = require('./exception-stream');
var ExceptionStream = require('./exception-stream');
/**

@@ -31,4 +28,2 @@ * Object for handling unhandledRejection events.

*/
module.exports = /*#__PURE__*/function () {

@@ -41,10 +36,9 @@ /**

_classCallCheck(this, RejectionHandler);
if (!logger) {
throw new Error('Logger is required to handle rejections');
}
this.logger = logger;
this.handlers = new Map();
}
/**

@@ -55,4 +49,2 @@ * Handles `unhandledRejection` events for the current process by adding any

*/
_createClass(RejectionHandler, [{

@@ -62,7 +54,5 @@ key: "handle",

var _this = this;
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
args[_key] = arguments[_key];
}
args.forEach(function (arg) {

@@ -74,6 +64,4 @@ if (Array.isArray(arg)) {

}
_this._addHandler(arg);
});
if (!this.catcher) {

@@ -84,2 +72,3 @@ this.catcher = this._unhandledRejection.bind(this);

}
/**

@@ -90,3 +79,2 @@ * Removes any handlers to `unhandledRejection` events for the current

*/
}, {

@@ -96,3 +84,2 @@ key: "unhandle",

var _this2 = this;
if (this.catcher) {

@@ -106,2 +93,3 @@ process.removeListener('unhandledRejection', this.catcher);

}
/**

@@ -112,3 +100,2 @@ * TODO: add method description

*/
}, {

@@ -118,7 +105,5 @@ key: "getAllInfo",

var message = null;
if (err) {
message = typeof err === 'string' ? err : err.message;
}
return {

@@ -137,2 +122,3 @@ error: err,

}
/**

@@ -142,3 +128,2 @@ * Gets all relevant process information for the currently running process.

*/
}, {

@@ -158,2 +143,3 @@ key: "getProcessInfo",

}
/**

@@ -163,3 +149,2 @@ * Gets all relevant OS information for the currently running process.

*/
}, {

@@ -173,2 +158,3 @@ key: "getOsInfo",

}
/**

@@ -179,3 +165,2 @@ * Gets a stack trace for the specified error.

*/
}, {

@@ -196,2 +181,3 @@ key: "getTrace",

}
/**

@@ -202,3 +188,2 @@ * Helper method to add a transport as an exception handler.

*/
}, {

@@ -214,2 +199,3 @@ key: "_addHandler",

}
/**

@@ -222,3 +208,2 @@ * Logs all relevant information around the `err` and exits the current

*/
}, {

@@ -228,21 +213,16 @@ key: "_unhandledRejection",

var info = this.getAllInfo(err);
var handlers = this._getRejectionHandlers(); // Calculate if we should exit on this error
var handlers = this._getRejectionHandlers();
// Calculate if we should exit on this error
var doExit = typeof this.logger.exitOnError === 'function' ? this.logger.exitOnError(err) : this.logger.exitOnError;
var timeout;
if (!handlers.length && doExit) {
// eslint-disable-next-line no-console
console.warn('winston: exitOnError cannot be true with no rejection handlers.'); // eslint-disable-next-line no-console
console.warn('winston: exitOnError cannot be true with no rejection handlers.');
// eslint-disable-next-line no-console
console.warn('winston: not exiting process.');
doExit = false;
}
function gracefulExit() {
debug('doExit', doExit);
debug('process._exiting', process._exiting);
if (doExit && !process._exiting) {

@@ -253,18 +233,17 @@ // Remark: Currently ignoring any rejections from transports when

clearTimeout(timeout);
} // eslint-disable-next-line no-process-exit
}
// eslint-disable-next-line no-process-exit
process.exit(1);
}
}
if (!handlers || handlers.length === 0) {
return process.nextTick(gracefulExit);
} // Log to all transports attempting to listen for when they are completed.
}
// Log to all transports attempting to listen for when they are completed.
asyncForEach(handlers, function (handler, next) {
var done = once(next);
var transport = handler.transport || handler; // Debug wrapping so that we can inspect what's going on under the covers.
var transport = handler.transport || handler;
// Debug wrapping so that we can inspect what's going on under the covers.
function onDone(event) {

@@ -276,3 +255,2 @@ return function () {

}
transport._ending = true;

@@ -284,5 +262,6 @@ transport.once('finish', onDone('finished'));

});
this.logger.log(info); // If exitOnError is true, then only allow the logging of exceptions to
this.logger.log(info);
// If exitOnError is true, then only allow the logging of exceptions to
// take up to `3000ms`.
if (doExit) {

@@ -292,2 +271,3 @@ timeout = setTimeout(gracefulExit, 3000);

}
/**

@@ -299,3 +279,2 @@ * Returns the list of transports and exceptionHandlers for this instance.

*/
}, {

@@ -314,4 +293,3 @@ key: "_getRejectionHandlers",

}]);
return RejectionHandler;
}();

@@ -7,11 +7,11 @@ /**

*/
'use strict';
var fs = require('fs');
var _require = require('string_decoder'),
StringDecoder = _require.StringDecoder;
StringDecoder = _require.StringDecoder;
var _require2 = require('readable-stream'),
Stream = _require2.Stream;
var _require2 = require('readable-stream'),
Stream = _require2.Stream;
/**

@@ -21,5 +21,4 @@ * Simple no-op function.

*/
function noop() {}
function noop() {}
/**

@@ -32,4 +31,2 @@ * TODO: add function description.

*/
module.exports = function (options, iter) {

@@ -42,9 +39,6 @@ var buffer = Buffer.alloc(64 * 1024);

var row = 0;
if (options.start === -1) {
delete options.start;
}
stream.readable = true;
stream.destroy = function () {

@@ -55,3 +49,2 @@ stream.destroyed = true;

};
fs.open(options.file, 'a+', '0644', function (err, fd) {

@@ -64,7 +57,5 @@ if (err) {

}
stream.destroy();
return;
}
(function read() {

@@ -75,3 +66,2 @@ if (stream.destroyed) {

}
return fs.read(fd, buffer, 0, buffer.length, pos, function (error, bytes) {

@@ -84,7 +74,5 @@ if (error) {

}
stream.destroy();
return;
}
if (!bytes) {

@@ -100,20 +88,14 @@ if (buff) {

}
row++;
buff = '';
}
return setTimeout(read, 1000);
}
var data = decode.write(buffer.slice(0, bytes));
if (!iter) {
stream.emit('data', data);
}
data = (buff + data).split(/\n+/);
var l = data.length - 1;
var i = 0;
for (; i < l; i++) {

@@ -128,6 +110,4 @@ // eslint-disable-next-line eqeqeq

}
row++;
}
buff = data[l];

@@ -139,8 +119,6 @@ pos += bytes;

});
if (!iter) {
return stream;
}
return stream.destroy;
};
/* eslint-disable no-console */
/*

@@ -9,33 +8,24 @@ * console.js: Transport for outputting to the console.

*/
'use strict';
function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }
function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, _toPropertyKey(descriptor.key), descriptor); } }
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
function _toPrimitive(input, hint) { if (_typeof(input) !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (_typeof(res) !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); Object.defineProperty(subClass, "prototype", { writable: false }); if (superClass) _setPrototypeOf(subClass, superClass); }
function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } else if (call !== void 0) { throw new TypeError("Derived constructors may only return object or undefined"); } return _assertThisInitialized(self); }
function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
var os = require('os');
var _require = require('triple-beam'),
LEVEL = _require.LEVEL,
MESSAGE = _require.MESSAGE;
LEVEL = _require.LEVEL,
MESSAGE = _require.MESSAGE;
var TransportStream = require('winston-transport');
var TransportStream = require('winston-transport');
/**

@@ -46,9 +36,5 @@ * Transport for outputting to the console.

*/
module.exports = /*#__PURE__*/function (_TransportStream) {
_inherits(Console, _TransportStream);
var _super = _createSuper(Console);
/**

@@ -61,9 +47,7 @@ * Constructor function for the Console transport object responsible for

var _this;
var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
_classCallCheck(this, Console);
_this = _super.call(this, options);
_this = _super.call(this, options); // Expose the name of this Transport on the prototype
// Expose the name of this Transport on the prototype
_this.name = options.name || 'console';

@@ -73,7 +57,6 @@ _this.stderrLevels = _this._stringArrayToSet(options.stderrLevels);

_this.eol = typeof options.eol === 'string' ? options.eol : os.EOL;
_this.setMaxListeners(30);
return _this;
}
/**

@@ -85,4 +68,2 @@ * Core logging method exposed to Winston.

*/
_createClass(Console, [{

@@ -92,7 +73,7 @@ key: "log",

var _this2 = this;
setImmediate(function () {
return _this2.emit('logged', info);
}); // Remark: what if there is no raw...?
});
// Remark: what if there is no raw...?
if (this.stderrLevels[info[LEVEL]]) {

@@ -106,3 +87,2 @@ if (console._stderr) {

}
if (callback) {

@@ -122,3 +102,2 @@ callback(); // eslint-disable-line callback-return

}
if (callback) {

@@ -130,3 +109,2 @@ callback(); // eslint-disable-line callback-return

}
if (console._stdout) {

@@ -139,3 +117,2 @@ // Node.js maps `process.stdout` to `console._stdout`.

}
if (callback) {

@@ -145,2 +122,3 @@ callback(); // eslint-disable-line callback-return

}
/**

@@ -154,3 +132,2 @@ * Returns a Set-like object with strArray's elements as keys (each with the

*/
}, {

@@ -161,7 +138,5 @@ key: "_stringArrayToSet",

errMsg = errMsg || 'Cannot make set from type other than Array of string elements';
if (!Array.isArray(strArray)) {
throw new Error(errMsg);
}
return strArray.reduce(function (set, el) {

@@ -171,3 +146,2 @@ if (typeof el !== 'string') {

}
set[el] = true;

@@ -178,4 +152,3 @@ return set;

}]);
return Console;
}(TransportStream);
/* eslint-disable complexity,max-statements */
/**

@@ -9,48 +8,32 @@ * file.js: Transport for outputting to a local log file.

*/
'use strict';
function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }
function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, _toPropertyKey(descriptor.key), descriptor); } }
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
function _toPrimitive(input, hint) { if (_typeof(input) !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (_typeof(res) !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); Object.defineProperty(subClass, "prototype", { writable: false }); if (superClass) _setPrototypeOf(subClass, superClass); }
function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } else if (call !== void 0) { throw new TypeError("Derived constructors may only return object or undefined"); } return _assertThisInitialized(self); }
function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
var fs = require('fs');
var path = require('path');
var asyncSeries = require('async/series');
var zlib = require('zlib');
var _require = require('triple-beam'),
MESSAGE = _require.MESSAGE;
MESSAGE = _require.MESSAGE;
var _require2 = require('readable-stream'),
Stream = _require2.Stream,
PassThrough = _require2.PassThrough;
Stream = _require2.Stream,
PassThrough = _require2.PassThrough;
var TransportStream = require('winston-transport');
var debug = require('@dabh/diagnostics')('winston:file');
var os = require('os');
var tailFile = require('../tail-file');
var tailFile = require('../tail-file');
/**

@@ -61,9 +44,5 @@ * Transport for outputting to a local log file.

*/
module.exports = /*#__PURE__*/function (_TransportStream) {
_inherits(File, _TransportStream);
var _super = _createSuper(File);
/**

@@ -76,12 +55,11 @@ * Constructor function for the File transport object responsible for

var _this;
var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
_classCallCheck(this, File);
_this = _super.call(this, options);
_this = _super.call(this, options); // Expose the name of this Transport on the prototype.
// Expose the name of this Transport on the prototype.
_this.name = options.name || 'file';
_this.name = options.name || 'file'; // Helper function which throws an `Error` in the event that any of the
// Helper function which throws an `Error` in the event that any of the
// rest of the arguments is present in `options`.
function throwIf(target) {

@@ -91,3 +69,2 @@ for (var _len = arguments.length, args = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {

}
args.slice(1).forEach(function (name) {

@@ -98,12 +75,10 @@ if (options[name]) {

});
} // Setup the base stream that always gets piped to to handle buffering.
}
// Setup the base stream that always gets piped to to handle buffering.
_this._stream = new PassThrough();
_this._stream.setMaxListeners(30);
_this._stream.setMaxListeners(30); // Bind this context for listener methods.
// Bind this context for listener methods.
_this._onError = _this._onError.bind(_assertThisInitialized(_this));
if (options.filename || options.dirname) {

@@ -121,3 +96,4 @@ throwIf('filename or dirname', 'stream');

_this._dest = _this._stream.pipe(_this._setupStream(options.stream));
_this.dirname = path.dirname(_this._dest.path); // We need to listen for drain events when write() returns false. This
_this.dirname = path.dirname(_this._dest.path);
// We need to listen for drain events when write() returns false. This
// can make node mad at times.

@@ -127,3 +103,2 @@ } else {

}
_this.maxsize = options.maxsize || null;

@@ -134,5 +109,7 @@ _this.rotationFormat = options.rotationFormat || false;

_this.eol = typeof options.eol === 'string' ? options.eol : os.EOL;
_this.tailable = options.tailable || false; // Internal state variables representing the number of files this instance
_this.tailable = options.tailable || false;
_this.lazy = options.lazy || false;
// Internal state variables representing the number of files this instance
// has created and the current size (in bytes) of the current logfile.
_this._size = 0;

@@ -144,9 +121,7 @@ _this._pendingSize = 0;

_this._ending = false;
_this._fileExist = false;
if (_this.dirname) _this._createLogDirIfNotExist(_this.dirname);
_this.open();
if (!_this.lazy) _this.open();
return _this;
}
_createClass(File, [{

@@ -156,3 +131,2 @@ key: "finishIfEnding",

var _this2 = this;
if (this._ending) {

@@ -164,3 +138,2 @@ if (this._opening) {

});
setImmediate(function () {

@@ -174,3 +147,2 @@ return _this2._stream.end();

});
setImmediate(function () {

@@ -182,2 +154,3 @@ return _this2._stream.end();

}
/**

@@ -189,3 +162,2 @@ * Core logging method exposed to Winston. Metadata is optional.

*/
}, {

@@ -195,5 +167,3 @@ key: "log",

var _this3 = this;
var callback = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : function () {};
// Remark: (jcrugzz) What is necessary about this callback(null, true) now

@@ -205,28 +175,51 @@ // when thinking about 3.x? Should silent be handled in the base

return true;
} // Output stream buffer is full and has asked us to wait for the drain event
}
// Output stream buffer is full and has asked us to wait for the drain event
if (this._drain) {
this._stream.once('drain', function () {
_this3._drain = false;
_this3.log(info, callback);
});
return;
}
if (this._rotate) {
this._stream.once('rotate', function () {
_this3._rotate = false;
_this3.log(info, callback);
});
return;
} // Grab the raw string and append the expected EOL.
}
if (this.lazy) {
if (!this._fileExist) {
if (!this._opening) {
this.open();
}
this.once('open', function () {
_this3._fileExist = true;
_this3.log(info, callback);
return;
});
return;
}
if (this._needsNewFile(this._pendingSize)) {
this._dest.once('close', function () {
if (!_this3._opening) {
_this3.open();
}
_this3.once('open', function () {
_this3.log(info, callback);
return;
});
return;
});
return;
}
}
// Grab the raw string and append the expected EOL.
var output = "".concat(info[MESSAGE]).concat(this.eol);
var bytes = Buffer.byteLength(output);
var output = "".concat(info[MESSAGE]).concat(this.eol);
var bytes = Buffer.byteLength(output); // After we have written to the PassThrough check to see if we need
// After we have written to the PassThrough check to see if we need
// to rotate to the next file.

@@ -236,44 +229,49 @@ //

// has been actually flushed to disk.
function logged() {
var _this4 = this;
this._size += bytes;
this._pendingSize -= bytes;
debug('logged %s %s', this._size, output);
this.emit('logged', info); // Do not attempt to rotate files while opening
this.emit('logged', info);
// Do not attempt to rotate files while rotating
if (this._rotate) {
return;
}
// Do not attempt to rotate files while opening
if (this._opening) {
return;
} // Check to see if we need to end the stream and create a new one.
}
// Check to see if we need to end the stream and create a new one.
if (!this._needsNewFile()) {
return;
} // End the current stream, ensure it flushes and create a new one.
}
if (this.lazy) {
this._endStream(function () {
_this4.emit('fileclosed');
});
return;
}
// End the current stream, ensure it flushes and create a new one.
// This could potentially be optimized to not run a stat call but its
// the safest way since we are supporting `maxFiles`.
this._rotate = true;
this._endStream(function () {
return _this4._rotateFile();
});
} // Keep track of the pending bytes being written while files are opening
}
// Keep track of the pending bytes being written while files are opening
// in order to properly rotate the PassThrough this._stream when the file
// eventually does open.
this._pendingSize += bytes;
if (this._opening && !this.rotatedWhileOpening && this._needsNewFile(this._size + this._pendingSize)) {
this.rotatedWhileOpening = true;
}
var written = this._stream.write(output, logged.bind(this));
if (!written) {
this._drain = true;
this._stream.once('drain', function () {

@@ -291,2 +289,3 @@ _this3._drain = false;

}
/**

@@ -298,3 +297,2 @@ * Query the transport. Options object is optional.

*/
}, {

@@ -307,3 +305,2 @@ key: "query",

}
options = normalizeQuery(options);

@@ -321,7 +318,5 @@ var file = path.join(this.dirname, this.filename);

}
if (!callback) {
return;
}
return err.code !== 'ENOENT' ? callback(err) : callback(null, results);

@@ -333,3 +328,2 @@ });

var i = 0;
for (; i < l; i++) {

@@ -339,6 +333,4 @@ if (!options.start || row >= options.start) {

}
row++;
}
buff = data[l];

@@ -350,15 +342,12 @@ });

}
if (options.order === 'desc') {
results = results.reverse();
} // eslint-disable-next-line callback-return
}
// eslint-disable-next-line callback-return
if (callback) callback(null, results);
});
function add(buff, attempt) {
try {
var log = JSON.parse(buff);
if (check(log)) {

@@ -373,3 +362,2 @@ push(log);

}
function push(log) {

@@ -380,6 +368,4 @@ if (options.rows && results.length >= options.rows && options.order !== 'desc') {

}
return;
}
if (options.fields) {

@@ -391,3 +377,2 @@ log = options.fields.reduce(function (obj, key) {

}
if (options.order === 'desc') {

@@ -398,6 +383,4 @@ if (results.length >= options.rows) {

}
results.push(log);
}
function check(log) {

@@ -407,37 +390,33 @@ if (!log) {

}
if (_typeof(log) !== 'object') {
return;
}
var time = new Date(log.timestamp);
if (options.from && time < options.from || options.until && time > options.until || options.level && options.level !== log.level) {
return;
}
return true;
}
function normalizeQuery(options) {
options = options || {}; // limit
options = options || {};
options.rows = options.rows || options.limit || 10; // starting row offset
// limit
options.rows = options.rows || options.limit || 10;
options.start = options.start || 0; // now
// starting row offset
options.start = options.start || 0;
// now
options.until = options.until || new Date();
if (_typeof(options.until) !== 'object') {
options.until = new Date(options.until);
} // now - 24
}
// now - 24
options.from = options.from || options.until - 24 * 60 * 60 * 1000;
if (_typeof(options.from) !== 'object') {
options.from = new Date(options.from);
} // 'asc' or 'desc'
}
// 'asc' or 'desc'
options.order = options.order || 'desc';

@@ -447,2 +426,3 @@ return options;

}
/**

@@ -454,3 +434,2 @@ * Returns a log stream for this transport. Options object is optional.

*/
}, {

@@ -470,3 +449,2 @@ key: "stream",

}
try {

@@ -482,2 +460,3 @@ stream.emit('data', line);

}
/**

@@ -487,3 +466,2 @@ * Checks to see the filesize of.

*/
}, {

@@ -493,3 +471,2 @@ key: "open",

var _this5 = this;
// If we do not have a filename then we were passed a stream and

@@ -499,4 +476,5 @@ // don't need to keep track of size.

if (this._opening) return;
this._opening = true; // Stat the target file to get the size and create the stream.
this._opening = true;
// Stat the target file to get the size and create the stream.
this.stat(function (err, size) {

@@ -506,3 +484,2 @@ if (err) {

}
debug('stat done: %s { size: %s }', _this5.filename, size);

@@ -512,3 +489,2 @@ _this5._size = size;

_this5._opening = false;
_this5.once('open', function () {

@@ -523,2 +499,3 @@ if (_this5._stream.eventNames().includes('rotate')) {

}
/**

@@ -529,3 +506,2 @@ * Stat the file and assess information in order to create the proper stream.

*/
}, {

@@ -535,14 +511,11 @@ key: "stat",

var _this6 = this;
var target = this._getFile();
var fullpath = path.join(this.dirname, target);
fs.stat(fullpath, function (err, stat) {
if (err && err.code === 'ENOENT') {
debug('ENOENT ok', fullpath); // Update internally tracked filename with the new target name.
debug('ENOENT ok', fullpath);
// Update internally tracked filename with the new target name.
_this6.filename = target;
return callback(null, 0);
}
if (err) {

@@ -552,3 +525,2 @@ debug("err ".concat(err.code, " ").concat(fullpath));

}
if (!stat || _this6._needsNewFile(stat.size)) {

@@ -560,6 +532,6 @@ // If `stats.size` is greater than the `maxsize` for this

});
} // Once we have figured out what the filename is, set it
}
// Once we have figured out what the filename is, set it
// and return the size.
_this6.filename = target;

@@ -569,2 +541,3 @@ callback(null, stat.size);

}
/**

@@ -575,3 +548,2 @@ * Closes the stream associated with this instance.

*/
}, {

@@ -581,7 +553,5 @@ key: "close",

var _this7 = this;
if (!this._stream) {
return;
}
this._stream.end(function () {

@@ -593,6 +563,6 @@ if (cb) {

_this7.emit('flush');
_this7.emit('closed');
});
}
/**

@@ -603,3 +573,2 @@ * TODO: add method description.

*/
}, {

@@ -611,2 +580,3 @@ key: "_needsNewFile",

}
/**

@@ -617,3 +587,2 @@ * TODO: add method description.

*/
}, {

@@ -624,2 +593,3 @@ key: "_onError",

}
/**

@@ -630,3 +600,2 @@ * TODO: add method description.

*/
}, {

@@ -638,2 +607,3 @@ key: "_setupStream",

}
/**

@@ -644,3 +614,2 @@ * TODO: add method description.

*/
}, {

@@ -650,8 +619,9 @@ key: "_cleanupStream",

stream.removeListener('error', this._onError);
stream.destroy();
return stream;
}
/**
* TODO: add method description.
*/
}, {

@@ -661,3 +631,2 @@ key: "_rotateFile",

var _this8 = this;
this._incFile(function () {

@@ -667,2 +636,3 @@ return _this8.open();

}
/**

@@ -675,3 +645,2 @@ * Unpipe from the stream that has been marked as full and end it so it

*/
}, {

@@ -681,11 +650,7 @@ key: "_endStream",

var _this9 = this;
var callback = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : function () {};
if (this._dest) {
this._stream.unpipe(this._dest);
this._dest.end(function () {
_this9._cleanupStream(_this9._dest);
callback();

@@ -697,2 +662,3 @@ });

}
/**

@@ -702,6 +668,5 @@ * Returns the WritableStream for the active file on this instance. If we

*
* @param {ReadableStream} source – PassThrough to pipe to the file when open.
* @param {ReadableStream} source –PassThrough to pipe to the file when open.
* @returns {WritableStream} Stream that writes to disk for the active file.
*/
}, {

@@ -711,6 +676,6 @@ key: "_createStream",

var _this10 = this;
var fullpath = path.join(this.dirname, this.filename);
debug('create stream start', fullpath, this.options);
var dest = fs.createWriteStream(fullpath, this.options) // TODO: What should we do with errors here?
var dest = fs.createWriteStream(fullpath, this.options)
// TODO: What should we do with errors here?
.on('error', function (err) {

@@ -722,20 +687,14 @@ return debug(err);

debug('file open ok', fullpath);
_this10.emit('open', fullpath);
source.pipe(dest);
source.pipe(dest); // If rotation occured during the open operation then we immediately
// If rotation occured during the open operation then we immediately
// start writing to a new PassThrough, begin opening the next file
// and cleanup the previous source and dest once the source has drained.
if (_this10.rotatedWhileOpening) {
_this10._stream = new PassThrough();
_this10._stream.setMaxListeners(30);
_this10._rotateFile();
_this10.rotatedWhileOpening = false;
_this10._cleanupStream(dest);
source.end();

@@ -745,3 +704,2 @@ }

debug('create stream ok', fullpath);
if (this.zippedArchive) {

@@ -752,5 +710,5 @@ var gzip = zlib.createGzip();

}
return dest;
}
/**

@@ -761,3 +719,2 @@ * TODO: add method description.

*/
}, {

@@ -769,6 +726,4 @@ key: "_incFile",

var basename = path.basename(this._basename, ext);
if (!this.tailable) {
this._created += 1;
this._checkMaxFilesIncrementing(ext, basename, callback);

@@ -779,2 +734,3 @@ } else {

}
/**

@@ -786,3 +742,2 @@ * Gets the next filename to use for this instance in the case that log

*/
}, {

@@ -793,9 +748,11 @@ key: "_getFile",

var basename = path.basename(this._basename, ext);
var isRotation = this.rotationFormat ? this.rotationFormat() : this._created; // Caveat emptor (indexzero): rotationFormat() was broken by design When
var isRotation = this.rotationFormat ? this.rotationFormat() : this._created;
// Caveat emptor (indexzero): rotationFormat() was broken by design When
// combined with max files because the set of files to unlink is never
// stored.
var target = !this.tailable && this._created ? "".concat(basename).concat(isRotation).concat(ext) : "".concat(basename).concat(ext);
return this.zippedArchive && !this.tailable ? "".concat(target, ".gz") : target;
}
/**

@@ -809,3 +766,2 @@ * Increment the number of files created or checked by this instance.

*/
}, {

@@ -818,3 +774,2 @@ key: "_checkMaxFilesIncrementing",

}
var oldest = this._created - this.maxFiles;

@@ -827,2 +782,3 @@ var isOldest = oldest !== 0 ? oldest : '';

}
/**

@@ -839,3 +795,2 @@ * Roll files forward based on integer, up to maxFiles. e.g. if base if

*/
}, {

@@ -845,16 +800,12 @@ key: "_checkMaxFilesTailable",

var _this12 = this;
var tasks = [];
if (!this.maxFiles) {
return;
} // const isZipped = this.zippedArchive ? '.gz' : '';
}
// const isZipped = this.zippedArchive ? '.gz' : '';
var isZipped = this.zippedArchive ? '.gz' : '';
for (var x = this.maxFiles - 1; x > 1; x--) {
tasks.push(function (i, cb) {
var _this11 = this;
var fileName = "".concat(basename).concat(i - 1).concat(ext).concat(isZipped);

@@ -866,3 +817,2 @@ var tmppath = path.join(this.dirname, fileName);

}
fileName = "".concat(basename).concat(i).concat(ext).concat(isZipped);

@@ -873,3 +823,2 @@ fs.rename(tmppath, path.join(_this11.dirname, fileName), cb);

}
asyncSeries(tasks, function () {

@@ -889,7 +838,5 @@ fs.rename(path.join(_this12.dirname, "".concat(basename).concat(ext)), path.join(_this12.dirname, "".concat(basename, "1").concat(ext).concat(isZipped)), callback);

/* eslint-enable no-sync */
}
}]);
return File;
}(TransportStream);

@@ -7,42 +7,28 @@ /**

*/
'use strict';
function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }
function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, _toPropertyKey(descriptor.key), descriptor); } }
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
function _toPrimitive(input, hint) { if (_typeof(input) !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (_typeof(res) !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); Object.defineProperty(subClass, "prototype", { writable: false }); if (superClass) _setPrototypeOf(subClass, superClass); }
function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } else if (call !== void 0) { throw new TypeError("Derived constructors may only return object or undefined"); } return _assertThisInitialized(self); }
function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
var http = require('http');
var https = require('https');
var _require = require('readable-stream'),
Stream = _require.Stream;
Stream = _require.Stream;
var TransportStream = require('winston-transport');
var jsonStringify = require('safe-stable-stringify');
var jsonStringify = require('safe-stable-stringify');
/**

@@ -53,9 +39,5 @@ * Transport for outputting to a json-rpc server.

*/
module.exports = /*#__PURE__*/function (_TransportStream) {
_inherits(Http, _TransportStream);
var _super = _createSuper(Http);
/**

@@ -69,7 +51,4 @@ * Constructor function for the Http transport object responsible for

var _this;
var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
_classCallCheck(this, Http);
_this = _super.call(this, options);

@@ -92,9 +71,8 @@ _this.options = options;

_this.batchCallback = {};
if (!_this.port) {
_this.port = _this.ssl ? 443 : 80;
}
return _this;
}
/**

@@ -106,4 +84,2 @@ * Core logging method exposed to Winston.

*/
_createClass(Http, [{

@@ -113,8 +89,6 @@ key: "log",

var _this2 = this;
this._request(info, function (err, res) {
this._request(info, null, null, function (err, res) {
if (res && res.statusCode !== 200) {
err = new Error("Invalid HTTP Status Code: ".concat(res.statusCode));
}
if (err) {

@@ -125,6 +99,6 @@ _this2.emit('warn', err);

}
}); // Remark: (jcrugzz) Fire and forget here so requests dont cause buffering
});
// Remark: (jcrugzz) Fire and forget here so requests dont cause buffering
// and block more requests from happening?
if (callback) {

@@ -134,2 +108,3 @@ setImmediate(callback);

}
/**

@@ -141,3 +116,2 @@ * Query the transport. Options object is optional.

*/
}, {

@@ -150,3 +124,2 @@ key: "query",

}
options = {

@@ -156,22 +129,13 @@ method: 'query',

};
if (options.params.path) {
options.path = options.params.path;
delete options.params.path;
}
if (options.params.auth) {
options.auth = options.params.auth;
delete options.params.auth;
}
this._request(options, function (err, res, body) {
var auth = options.params.auth || null;
delete options.params.auth;
var path = options.params.path || null;
delete options.params.path;
this._request(options, auth, path, function (err, res, body) {
if (res && res.statusCode !== 200) {
err = new Error("Invalid HTTP Status Code: ".concat(res.statusCode));
}
if (err) {
return callback(err);
}
if (typeof body === 'string') {

@@ -184,6 +148,6 @@ try {

}
callback(null, body);
});
}
/**

@@ -194,3 +158,2 @@ * Returns a log stream for this transport. Options object is optional.

*/
}, {

@@ -205,21 +168,11 @@ key: "stream",

};
if (options.params.path) {
options.path = options.params.path;
delete options.params.path;
}
if (options.params.auth) {
options.auth = options.params.auth;
delete options.params.auth;
}
var path = options.params.path || null;
delete options.params.path;
var auth = options.params.auth || null;
delete options.params.auth;
var buff = '';
var req = this._request(options);
var req = this._request(options, auth, path);
stream.destroy = function () {
return req.destroy();
};
req.on('data', function (data) {

@@ -229,3 +182,2 @@ data = (buff + data).split(/\n+/);

var i = 0;
for (; i < l; i++) {

@@ -238,3 +190,2 @@ try {

}
buff = data[l];

@@ -247,2 +198,3 @@ });

}
/**

@@ -252,14 +204,12 @@ * Make a request to a winstond server or any http server which can

* @param {function} options - Options to sent the request.
* @param {Object?} auth - authentication options
* @param {string} path - request path
* @param {function} callback - Continuation to respond to when complete.
*/
}, {
key: "_request",
value: function _request(options, callback) {
value: function _request(options, auth, path, callback) {
options = options || {};
var auth = options.auth || this.auth;
var path = options.path || this.path || '';
delete options.auth;
delete options.path;
auth = auth || this.auth;
path = path || this.path || '';
if (this.batch) {

@@ -271,2 +221,3 @@ this._doBatch(options, callback, auth, path);

}
/**

@@ -279,3 +230,2 @@ * Send or memorize the options according to batch configuration

*/
}, {

@@ -285,3 +235,2 @@ key: "_doBatch",

this.batchOptions.push(options);
if (this.batchOptions.length === 1) {

@@ -294,7 +243,5 @@ // First message stored, it's time to start the timeout!

me.batchTimeoutID = -1;
me._doBatchRequest(me.batchCallback, auth, path);
}, this.batchInterval);
}
if (this.batchOptions.length === this.batchCount) {

@@ -305,2 +252,3 @@ // max batch count is reached, send all messages to endpoint

}
/**

@@ -312,3 +260,2 @@ * Initiate a request with the memorized batch options, stop the batch timeout

*/
}, {

@@ -321,8 +268,7 @@ key: "_doBatchRequest",

}
var batchOptionsCopy = this.batchOptions.slice();
this.batchOptions = [];
this._doRequest(batchOptionsCopy, callback, auth, path);
}
/**

@@ -336,3 +282,2 @@ * Make a request to a winstond server or any http server which can

*/
}, {

@@ -343,7 +288,5 @@ key: "_doRequest",

var headers = Object.assign({}, this.headers);
if (auth && auth.bearer) {
headers.Authorization = "Bearer ".concat(auth.bearer);
}
var req = (this.ssl ? https : http).request(_objectSpread(_objectSpread({}, this.options), {}, {

@@ -364,7 +307,6 @@ method: 'POST',

});
req.end(Buffer.from(jsonStringify(options), 'utf8'));
req.end(Buffer.from(jsonStringify(options, this.options.replacer), 'utf8'));
}
}]);
return Http;
}(TransportStream);

@@ -7,3 +7,5 @@ /**

*/
'use strict';
/**

@@ -13,3 +15,2 @@ * TODO: add property description.

*/
Object.defineProperty(exports, 'Console', {

@@ -22,2 +23,3 @@ configurable: true,

});
/**

@@ -27,3 +29,2 @@ * TODO: add property description.

*/
Object.defineProperty(exports, 'File', {

@@ -36,2 +37,3 @@ configurable: true,

});
/**

@@ -41,3 +43,2 @@ * TODO: add property description.

*/
Object.defineProperty(exports, 'Http', {

@@ -50,2 +51,3 @@ configurable: true,

});
/**

@@ -55,3 +57,2 @@ * TODO: add property description.

*/
Object.defineProperty(exports, 'Stream', {

@@ -58,0 +59,0 @@ configurable: true,

@@ -7,34 +7,24 @@ /**

*/
'use strict';
function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }
function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, _toPropertyKey(descriptor.key), descriptor); } }
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
function _toPrimitive(input, hint) { if (_typeof(input) !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (_typeof(res) !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); Object.defineProperty(subClass, "prototype", { writable: false }); if (superClass) _setPrototypeOf(subClass, superClass); }
function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } else if (call !== void 0) { throw new TypeError("Derived constructors may only return object or undefined"); } return _assertThisInitialized(self); }
function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
var isStream = require('is-stream');
var _require = require('triple-beam'),
MESSAGE = _require.MESSAGE;
MESSAGE = _require.MESSAGE;
var os = require('os');
var TransportStream = require('winston-transport');
var TransportStream = require('winston-transport');
/**

@@ -45,9 +35,5 @@ * Transport for outputting to any arbitrary stream.

*/
module.exports = /*#__PURE__*/function (_TransportStream) {
_inherits(Stream, _TransportStream);
var _super = _createSuper(Stream);
/**

@@ -60,19 +46,13 @@ * Constructor function for the Console transport object responsible for

var _this;
var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
_classCallCheck(this, Stream);
_this = _super.call(this, options);
if (!options.stream || !isStream(options.stream)) {
throw new Error('options.stream is required.');
} // We need to listen for drain events when write() returns false. This can
}
// We need to listen for drain events when write() returns false. This can
// make node mad at times.
_this._stream = options.stream;
_this._stream.setMaxListeners(Infinity);
_this.isObjectMode = options.stream._writableState.objectMode;

@@ -82,2 +62,3 @@ _this.eol = typeof options.eol === 'string' ? options.eol : os.EOL;

}
/**

@@ -89,4 +70,2 @@ * Core logging method exposed to Winston.

*/
_createClass(Stream, [{

@@ -96,10 +75,7 @@ key: "log",

var _this2 = this;
setImmediate(function () {
return _this2.emit('logged', info);
});
if (this.isObjectMode) {
this._stream.write(info);
if (callback) {

@@ -111,5 +87,3 @@ callback(); // eslint-disable-line callback-return

}
this._stream.write("".concat(info[MESSAGE]).concat(this.eol));
if (callback) {

@@ -122,4 +96,3 @@ callback(); // eslint-disable-line callback-return

}]);
return Stream;
}(TransportStream);

@@ -6,3 +6,3 @@ // Type definitions for winston 3.0

import * as NodeJSStream from "stream";
import * as NodeJSStream from 'stream';

@@ -23,3 +23,4 @@ import * as logform from 'logform';

interface ExceptionHandler {
class ExceptionHandler {
constructor(logger: Logger);
logger: Logger;

@@ -35,7 +36,6 @@ handlers: Map<any, any>;

getTrace(err: Error): object;
}
new(logger: Logger): ExceptionHandler;
}
interface RejectionHandler {
class RejectionHandler {
constructor(logger: Logger);
logger: Logger;

@@ -51,4 +51,2 @@ handlers: Map<any, any>;

getTrace(err: Error): object;
new(logger: Logger): RejectionHandler;
}

@@ -62,7 +60,7 @@

until?: Date;
order?: "asc" | "desc";
order?: 'asc' | 'desc';
fields: any;
}
interface Profiler {
class Profiler {
logger: Logger;

@@ -73,3 +71,8 @@ start: Number;

type LogCallback = (error?: any, level?: string, message?: string, meta?: any) => void;
type LogCallback = (
error?: any,
level?: string,
message?: string,
meta?: any
) => void;

@@ -82,3 +85,3 @@ interface LogEntry {

interface LogMethod {
interface LogMethod {
(level: string, message: string, callback: LogCallback): Logger;

@@ -113,3 +116,5 @@ (level: string, message: string, meta: any, callback: LogCallback): Logger;

interface Logger extends NodeJSStream.Transform {
class Logger extends NodeJSStream.Transform {
constructor(options?: LoggerOptions);
silent: boolean;

@@ -127,6 +132,6 @@ format: logform.Format;

log: LogMethod;
add(transport: Transport): Logger;
remove(transport: Transport): Logger;
clear(): Logger;
close(): Logger;
add(transport: Transport): this;
remove(transport: Transport): this;
clear(): this;
close(): this;

@@ -153,11 +158,14 @@ // for cli and npm levels

query(options?: QueryOptions, callback?: (err: Error, results: any) => void): any;
query(
options?: QueryOptions,
callback?: (err: Error, results: any) => void
): any;
stream(options?: any): NodeJS.ReadableStream;
startTimer(): Profiler;
profile(id: string | number, meta?: LogEntry): Logger;
profile(id: string | number, meta?: Record<string, any>): this;
configure(options: LoggerOptions): void;
child(options: Object): Logger;
child(options: Object): this;

@@ -171,7 +179,5 @@ isLevelEnabled(level: string): boolean;

isSillyEnabled(): boolean;
new(options?: LoggerOptions): Logger;
}
interface Container {
class Container {
loggers: Map<string, Logger>;

@@ -185,9 +191,6 @@ options: LoggerOptions;

new(options?: LoggerOptions): Container;
constructor(options?: LoggerOptions);
}
let version: string;
let ExceptionHandler: ExceptionHandler;
let RejectionHandler: RejectionHandler;
let Container: Container;
let loggers: Container;

@@ -209,3 +212,6 @@

let log: LogMethod;
let query: (options?: QueryOptions, callback?: (err: Error, results: any) => void) => any;
let query: (
options?: QueryOptions,
callback?: (err: Error, results: any) => void
) => any;
let stream: (options?: any) => NodeJS.ReadableStream;

@@ -212,0 +218,0 @@ let add: (transport: Transport) => Logger;

@@ -45,2 +45,7 @@ /**

* Expose core Logging-related prototypes.
* @type {function}
*/
exports.Logger = require('./winston/logger');
/**
* Expose core Logging-related prototypes.
* @type {Object}

@@ -176,3 +181,2 @@ */

warn.forProperties(exports, 'deprecated', ['emitErrs', 'levelLength']);
// Throw a useful error when users attempt to run `new winston.Logger`.
warn.moved(exports, 'createLogger', 'Logger');

@@ -37,17 +37,2 @@ /**

},
moved(obj, movedTo, prop) {
function movedNotice() {
return () => {
throw new Error([
format('winston.%s was moved in winston@3.0.0.', prop),
format('Use a winston.%s instead.', movedTo)
].join('\n'));
};
}
Object.defineProperty(obj, prop, {
get: movedNotice,
set: movedNotice
});
},
forProperties(obj, type, props) {

@@ -54,0 +39,0 @@ props.forEach(prop => {

@@ -0,0 +0,0 @@ // Type definitions for winston 3.0

@@ -0,0 +0,0 @@ /**

@@ -43,3 +43,7 @@ /**

// make copies of those references.
options.transports = existing ? existing.slice() : [];
if (existing) {
options.transports = Array.isArray(existing) ? existing.slice() : [existing];
} else {
options.transports = [];
}

@@ -46,0 +50,0 @@ const logger = createLogger(options);

@@ -0,0 +0,0 @@ /**

@@ -76,5 +76,5 @@ /**

getAllInfo(err) {
let { message } = err;
if (!message && typeof err === 'string') {
message = err;
let message = null;
if (err) {
message = typeof err === 'string' ? err : err.message;
}

@@ -88,5 +88,5 @@

`uncaughtException: ${(message || '(no error message)')}`,
err.stack || ' No stack trace'
err && err.stack || ' No stack trace'
].join('\n'),
stack: err.stack,
stack: err && err.stack,
exception: true,

@@ -93,0 +93,0 @@ date: new Date().toString(),

@@ -303,3 +303,3 @@ /**

console.error(
'[winston] Attempt to write logs with no transports %j',
'[winston] Attempt to write logs with no transports, which can increase memory usage: %j',
info

@@ -306,0 +306,0 @@ );

@@ -9,3 +9,2 @@ /**

'use strict';
/**

@@ -16,3 +15,3 @@ * TODO: add class description.

*/
module.exports = class Profiler {
class Profiler {
/**

@@ -26,8 +25,9 @@ * Constructor function for the Profiler instance used by

constructor(logger) {
if (!logger) {
throw new Error('Logger is required for profiling.');
const Logger = require('./logger');
if (typeof logger !== 'object' || Array.isArray(logger) || !(logger instanceof Logger)) {
throw new Error('Logger is required for profiling');
} else {
this.logger = logger;
this.start = Date.now();
}
this.logger = logger;
this.start = Date.now();
}

@@ -55,1 +55,3 @@

};
module.exports = Profiler;

@@ -0,0 +0,0 @@ /**

@@ -0,0 +0,0 @@ /* eslint-disable no-console */

@@ -82,2 +82,3 @@ /* eslint-disable complexity,max-statements */

this.tailable = options.tailable || false;
this.lazy = options.lazy || false;

@@ -92,5 +93,6 @@ // Internal state variables representing the number of files this instance

this._ending = false;
this._fileExist = false;
if (this.dirname) this._createLogDirIfNotExist(this.dirname);
this.open();
if (!this.lazy) this.open();
}

@@ -112,3 +114,2 @@

/**

@@ -120,3 +121,3 @@ * Core logging method exposed to Winston. Metadata is optional.

*/
log(info, callback = () => {}) {
log(info, callback = () => { }) {
// Remark: (jcrugzz) What is necessary about this callback(null, true) now

@@ -130,2 +131,3 @@ // when thinking about 3.x? Should silent be handled in the base

// Output stream buffer is full and has asked us to wait for the drain event

@@ -146,2 +148,28 @@ if (this._drain) {

}
if (this.lazy) {
if (!this._fileExist) {
if (!this._opening) {
this.open();
}
this.once('open', () => {
this._fileExist = true;
this.log(info, callback);
return;
});
return;
}
if (this._needsNewFile(this._pendingSize)) {
this._dest.once('close', () => {
if (!this._opening) {
this.open();
}
this.once('open', () => {
this.log(info, callback);
return;
});
return;
});
return;
}
}

@@ -164,2 +192,7 @@ // Grab the raw string and append the expected EOL.

// Do not attempt to rotate files while rotating
if (this._rotate) {
return;
}
// Do not attempt to rotate files while opening

@@ -174,2 +207,6 @@ if (this._opening) {

}
if (this.lazy) {
this._endStream(() => {this.emit('fileclosed')});
return;
}

@@ -513,3 +550,3 @@ // End the current stream, ensure it flushes and create a new one.

stream.removeListener('error', this._onError);
stream.destroy();
return stream;

@@ -532,3 +569,3 @@ }

*/
_endStream(callback = () => {}) {
_endStream(callback = () => { }) {
if (this._dest) {

@@ -549,3 +586,3 @@ this._stream.unpipe(this._dest);

*
* @param {ReadableStream} source – PassThrough to pipe to the file when open.
* @param {ReadableStream} source –PassThrough to pipe to the file when open.
* @returns {WritableStream} Stream that writes to disk for the active file.

@@ -552,0 +589,0 @@ */

@@ -60,3 +60,3 @@ /**

log(info, callback) {
this._request(info, (err, res) => {
this._request(info, null, null, (err, res) => {
if (res && res.statusCode !== 200) {

@@ -97,13 +97,9 @@ err = new Error(`Invalid HTTP Status Code: ${res.statusCode}`);

if (options.params.path) {
options.path = options.params.path;
delete options.params.path;
}
const auth = options.params.auth || null;
delete options.params.auth;
if (options.params.auth) {
options.auth = options.params.auth;
delete options.params.auth;
}
const path = options.params.path || null;
delete options.params.path;
this._request(options, (err, res, body) => {
this._request(options, auth, path, (err, res, body) => {
if (res && res.statusCode !== 200) {

@@ -141,14 +137,10 @@ err = new Error(`Invalid HTTP Status Code: ${res.statusCode}`);

if (options.params.path) {
options.path = options.params.path;
delete options.params.path;
}
const path = options.params.path || null;
delete options.params.path;
if (options.params.auth) {
options.auth = options.params.auth;
delete options.params.auth;
}
const auth = options.params.auth || null;
delete options.params.auth;
let buff = '';
const req = this._request(options);
const req = this._request(options, auth, path);

@@ -180,13 +172,12 @@ stream.destroy = () => req.destroy();

* @param {function} options - Options to sent the request.
* @param {Object?} auth - authentication options
* @param {string} path - request path
* @param {function} callback - Continuation to respond to when complete.
*/
_request(options, callback) {
_request(options, auth, path, callback) {
options = options || {};
const auth = options.auth || this.auth;
const path = options.path || this.path || '';
auth = auth || this.auth;
path = path || this.path || '';
delete options.auth;
delete options.path;
if (this.batch) {

@@ -269,4 +260,4 @@ this._doBatch(options, callback, auth, path);

));
req.end(Buffer.from(jsonStringify(options), 'utf8'));
req.end(Buffer.from(jsonStringify(options, this.options.replacer), 'utf8'));
}
};

@@ -37,2 +37,3 @@ // Type definitions for winston 3.0

tailable?: boolean;
lazy?: boolean;
}

@@ -51,2 +52,3 @@

tailable: boolean;
lazy: boolean;

@@ -67,2 +69,3 @@ new(options?: FileTransportOptions): FileTransportInstance;

batchCount?: number;
replacer?: (key: string, value: any) => any;
}

@@ -69,0 +72,0 @@

{
"name": "winston",
"description": "A logger for just about everything.",
"version": "3.7.2",
"version": "3.11.0",
"author": "Charlie Robbins <charlie.robbins@gmail.com>",

@@ -28,2 +28,3 @@ "maintainers": [

"@dabh/diagnostics": "^2.0.2",
"@colors/colors": "^1.6.0",
"async": "^3.2.3",

@@ -43,5 +44,4 @@ "is-stream": "^2.0.0",

"@babel/preset-env": "^7.16.7",
"@colors/colors": "1.5.0",
"@dabh/eslint-config-populist": "^5.0.0",
"@types/node": "^17.0.17",
"@types/node": "^20.3.1",
"abstract-winston-transport": "^0.5.1",

@@ -54,3 +54,3 @@ "assume": "^2.2.0",

"nyc": "^15.1.0",
"rimraf": "^3.0.2",
"rimraf": "^5.0.5",
"split2": "^4.1.0",

@@ -61,3 +61,3 @@ "std-mocks": "^1.0.1",

},
"main": "./lib/winston",
"main": "./lib/winston.js",
"browser": "./dist/winston",

@@ -64,0 +64,0 @@ "types": "./index.d.ts",

@@ -81,2 +81,5 @@ # winston

logger to use throughout your application if you so choose.
Note that the default logger doesn't have any transports by default.
You need add transports by yourself, and leaving the default logger without any
transports may produce a high memory usage issue.

@@ -153,3 +156,3 @@ ## Table of contents

| ------------- | --------------------------- | --------------- |
| `level` | `'info'` | Log only if [`info.level`](#streams-objectmode-and-info-objects) less than or equal to this level |
| `level` | `'info'` | Log only if [`info.level`](#streams-objectmode-and-info-objects) is less than or equal to this level |
| `levels` | `winston.config.npm.levels` | Levels (and colors) representing log priorities |

@@ -228,2 +231,3 @@ | `format` | `winston.format.json` | Formatting for `info` messages (see: [Formats]) |

```
> `.child` is likely to be bugged if you're also extending the `Logger` class, due to some implementation details that make `this` keyword to point to unexpected things. Use with caution.

@@ -459,3 +463,3 @@ ### Streams, `objectMode`, and `info` objects

`winston.format` is designed to be as simple as possible. To define a new
format simple pass it a `transform(info, opts)` function to get a new
format, simply pass it a `transform(info, opts)` function to get a new
`Format`.

@@ -768,7 +772,7 @@

}),
new transports.Http({
new winston.transports.Http({
level: 'warn',
format: winston.format.json()
}),
new transports.Console({
new winston.transports.Console({
level: 'info',

@@ -974,3 +978,3 @@ format: winston.format.combine(

Also you can start a timer and keep a reference that you can call `.done()``
Also you can start a timer and keep a reference that you can call `.done()`
on:

@@ -1100,3 +1104,4 @@

It is also worth mentioning that the logger also emits an 'error' event which
It is also worth mentioning that the logger also emits an 'error' event
if an error occurs within the logger itself which
you should handle or suppress if you don't want unhandled exceptions:

@@ -1106,3 +1111,3 @@

//
// Handle errors
// Handle errors originating in the logger itself
//

@@ -1109,0 +1114,0 @@ logger.on('error', function (err) { /* Do Something */ });

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc