@cley_faye/boilerplate 3.13.0 → 3.14.0
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/README.md +3 -0
- package/lib/express/logger.js +2 -1
- package/lib/express/pipelinebuilder.d.ts +1 -0
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -333,6 +333,9 @@ It supports the following properties:
|
|
|
333
333
|
property.
|
|
334
334
|
- logger: an instance of a winston logger.
|
|
335
335
|
- timestamp: set to true to prepend a timestamp to each log line
|
|
336
|
+
- ignoredRoutes: array of path to not log
|
|
337
|
+
|
|
338
|
+
Note that if `route` is a full object, some of the other proprties might be ignored.
|
|
336
339
|
|
|
337
340
|
The middleware options allow enabling/disabling common middlewares.
|
|
338
341
|
Currently only support a few builtin middlewares from express:
|
package/lib/express/logger.js
CHANGED
|
@@ -81,7 +81,7 @@ const defaultRouteLoggerConfig = (authFromReq) => ({
|
|
|
81
81
|
});
|
|
82
82
|
exports.defaultRouteLoggerConfig = defaultRouteLoggerConfig;
|
|
83
83
|
const registerRouteLogger = (app, logOptions) => {
|
|
84
|
-
const { route, timestamp, userFromReq, authFromReq } = logOptions ?? {};
|
|
84
|
+
const { route, timestamp, userFromReq, authFromReq, ignoredRoutes } = logOptions ?? {};
|
|
85
85
|
let extraConfig;
|
|
86
86
|
if (typeof route === "boolean") {
|
|
87
87
|
extraConfig = (0, exports.defaultRouteLoggerConfig)(authFromReq ?? userFromReq);
|
|
@@ -100,6 +100,7 @@ const registerRouteLogger = (app, logOptions) => {
|
|
|
100
100
|
expressFormat: false,
|
|
101
101
|
format: customRouteFormat(timestamp),
|
|
102
102
|
msg: "{{req.method}} {{req.url}} {{res.statusCode}} {{res.responseTime}}ms",
|
|
103
|
+
ignoredRoutes,
|
|
103
104
|
};
|
|
104
105
|
app.use(express_winston_1.default.logger({
|
|
105
106
|
transports: winston_js_1.transports,
|
|
@@ -31,6 +31,7 @@ export interface LogOptions {
|
|
|
31
31
|
logger?: winston.Logger;
|
|
32
32
|
timestamp?: boolean;
|
|
33
33
|
extraStacktraceFilter?: Array<RegExp> | RegExp;
|
|
34
|
+
ignoredRoutes?: Array<string>;
|
|
34
35
|
/** @deprecated Use `authFromReq` instead */
|
|
35
36
|
userFromReq?: UserFromReqFunc;
|
|
36
37
|
authFromReq?: UserFromReqFunc;
|