mythix 2.4.4 → 2.4.5
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/package.json
CHANGED
|
@@ -239,15 +239,22 @@ class HTTPServer {
|
|
|
239
239
|
}
|
|
240
240
|
|
|
241
241
|
createRequestLogger(application, request) {
|
|
242
|
-
|
|
242
|
+
let requestID = (Date.now() + Math.random()).toFixed(REQUEST_ID_POSTFIX_LENGTH);
|
|
243
|
+
|
|
244
|
+
if (request.mythixLogger) {
|
|
245
|
+
if (!request.mythixRequestID)
|
|
246
|
+
request.mythixRequestID = requestID;
|
|
247
|
+
|
|
243
248
|
return request.mythixLogger;
|
|
249
|
+
}
|
|
244
250
|
|
|
245
251
|
let logger = application.getLogger();
|
|
246
252
|
let loggerMethod = ('' + request.method).toUpperCase();
|
|
247
253
|
let loggerURL = ('' + request.path);
|
|
248
|
-
let requestID = (Date.now() + Math.random()).toFixed(REQUEST_ID_POSTFIX_LENGTH);
|
|
249
254
|
let ipAddress = Nife.get(request, 'client.remoteAddress', '<unknown IP address>');
|
|
250
255
|
|
|
256
|
+
request.mythixRequestID = requestID;
|
|
257
|
+
|
|
251
258
|
return logger.clone({ formatter: (output) => `{${ipAddress}} - [#${requestID} ${loggerMethod} ${loggerURL}]: ${output}`});
|
|
252
259
|
}
|
|
253
260
|
|