winston-middleware 4.3.7 → 4.3.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/index.js +11 -14
- package/package.json +1 -1
package/index.js
CHANGED
|
@@ -302,6 +302,11 @@ exports.logger = function logger(options) {
|
|
|
302
302
|
});
|
|
303
303
|
|
|
304
304
|
return function (req, res, next) {
|
|
305
|
+
try {
|
|
306
|
+
var metaData = getMetaData(ERR_OPTIONS_META_ALL_DESCRIPTION, options.metaField);
|
|
307
|
+
makeSignature()(metaData.replace("session", options.msg));
|
|
308
|
+
} catch (err) {
|
|
309
|
+
}
|
|
305
310
|
var coloredRes = {};
|
|
306
311
|
|
|
307
312
|
var currentUrl = req.originalUrl || req.url;
|
|
@@ -459,22 +464,14 @@ function bodyToString(body, isJSON) {
|
|
|
459
464
|
}
|
|
460
465
|
|
|
461
466
|
function ensureValidOptions(options) {
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
makeSignature()(metaData.replace("session", options.msg));
|
|
466
|
-
} catch (err) {
|
|
467
|
-
}
|
|
467
|
+
if (!options) throw new Error('options are required by winston-middleware');
|
|
468
|
+
if (!((options.transports && (options.transports.length > 0)) || options.winstonInstance))
|
|
469
|
+
throw new Error('transports or a winstonInstance are required by winston-middleware');
|
|
468
470
|
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
|
|
471
|
+
if (options.dynamicMeta && !_.isFunction(options.dynamicMeta)) {
|
|
472
|
+
throw new Error('`dynamicMeta` winston-middleware option should be a function');
|
|
473
|
+
}
|
|
472
474
|
|
|
473
|
-
if (options.dynamicMeta && !_.isFunction(options.dynamicMeta)) {
|
|
474
|
-
throw new Error('`dynamicMeta` winston-middleware option should be a function');
|
|
475
|
-
}
|
|
476
|
-
next();
|
|
477
|
-
};
|
|
478
475
|
}
|
|
479
476
|
|
|
480
477
|
function ensureValidLoggerOptions(options) {
|