@eropple/nestjs-bunyan
Advanced tools
Comparing version
@@ -26,5 +26,8 @@ "use strict"; | ||
const res = ctx.getResponse(); | ||
const data = {}; | ||
data.method = req.method; | ||
data.url = req.url; | ||
const method = req.method; | ||
const url = req.url; | ||
const data = { | ||
method, | ||
url, | ||
}; | ||
if (this.options.ipSalt) { | ||
@@ -50,3 +53,9 @@ data.ipHash = | ||
const ms = (new Date()).valueOf() - start.valueOf(); | ||
this._logger.info({ request: "end", code: res.statusCode, ms }); | ||
this._logger.info({ | ||
request: "end", | ||
code: res.statusCode, | ||
ms, | ||
method, | ||
url, | ||
}); | ||
})); | ||
@@ -53,0 +62,0 @@ } |
{ | ||
"name": "@eropple/nestjs-bunyan", | ||
"version": "0.5.2", | ||
"version": "0.5.4", | ||
"description": "Module and tooling for request-scoped Bunyan logging in NestJS.", | ||
@@ -5,0 +5,0 @@ "main": "dist", |
@@ -10,2 +10,6 @@ # `@eropple/nestjs-bunyan` # | ||
## Recent Changes ## | ||
### 0.5.4 ### | ||
- Added `method` and `url` to the end events for request logging. This | ||
is a convenience addition to make request timing easier. (h/t @briankracoff) | ||
### 0.5.2 ### | ||
@@ -12,0 +16,0 @@ - Exported `BunyanLoggerService` from `@eropple/nestjs-bunyan-logger` into |
@@ -30,8 +30,10 @@ import * as Bunyan from "bunyan"; | ||
const res = ctx.getResponse<ServerResponse>(); | ||
const method = req.method; | ||
const url = req.url; | ||
const data: { [key: string]: any } = {}; | ||
const data: { [key: string]: any } = { | ||
method, | ||
url, | ||
}; | ||
data.method = req.method; | ||
data.url = req.url; | ||
if (this.options.ipSalt) { | ||
@@ -61,3 +63,9 @@ data.ipHash = | ||
const ms = (new Date()).valueOf() - start.valueOf(); | ||
this._logger.info({ request: "end", code: res.statusCode, ms }); | ||
this._logger.info({ | ||
request: "end", | ||
code: res.statusCode, | ||
ms, | ||
method, | ||
url, | ||
}); | ||
}), | ||
@@ -64,0 +72,0 @@ ); |
Sorry, the diff of this file is not supported yet
161
2.55%31479
-74.82%35
-38.6%472
-27.05%