@riocrypto/common-server 1.0.1912 → 1.0.1913
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/build/services/logger.js +10 -5
- package/package.json +1 -1
package/build/services/logger.js
CHANGED
|
@@ -75,12 +75,17 @@ class LoggerService {
|
|
|
75
75
|
});
|
|
76
76
|
this.requestMethodFilter = (0, winston_1.format)((info) => {
|
|
77
77
|
const allowedMethods = ["POST", "PATCH", "DELETE"];
|
|
78
|
-
if
|
|
79
|
-
|
|
80
|
-
allowedMethods.includes(info.meta.req.method)) {
|
|
81
|
-
|
|
78
|
+
// Only apply filter if req.method is defined
|
|
79
|
+
if (info.meta && info.meta.req && info.meta.req.method) {
|
|
80
|
+
if (allowedMethods.includes(info.meta.req.method)) {
|
|
81
|
+
return info;
|
|
82
|
+
}
|
|
83
|
+
else {
|
|
84
|
+
return false; // Filter out logs for other methods
|
|
85
|
+
}
|
|
82
86
|
}
|
|
83
|
-
|
|
87
|
+
// If there's no req.method, don't filter out the log
|
|
88
|
+
return info;
|
|
84
89
|
});
|
|
85
90
|
this.logger = null;
|
|
86
91
|
}
|