@tsed/platform-log-request 8.40.2 → 8.41.1
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.
|
@@ -2,7 +2,7 @@ import type { DIContext } from "@tsed/di";
|
|
|
2
2
|
export type AlterLogCallback = (level: "debug" | "info" | "warn" | "error" | "all", obj: Record<string, unknown>, ctx: DIContext) => Record<string, unknown>;
|
|
3
3
|
export interface PlatformLogRequestSettings {
|
|
4
4
|
/**
|
|
5
|
-
* Log all incoming
|
|
5
|
+
* Log all incoming requests. By default, true.
|
|
6
6
|
*/
|
|
7
7
|
logRequest?: boolean;
|
|
8
8
|
/**
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tsed/platform-log-request",
|
|
3
|
-
"version": "8.
|
|
3
|
+
"version": "8.41.1",
|
|
4
4
|
"description": "Log request module for Ts.ED Framework (Express, Koa, Serverless)",
|
|
5
5
|
"source": "./src/index.ts",
|
|
6
6
|
"type": "module",
|
|
@@ -26,11 +26,11 @@
|
|
|
26
26
|
"tslib": ">=2.7.0"
|
|
27
27
|
},
|
|
28
28
|
"devDependencies": {
|
|
29
|
-
"@tsed/barrels": "8.
|
|
30
|
-
"@tsed/di": "8.
|
|
31
|
-
"@tsed/platform-middlewares": "8.
|
|
32
|
-
"@tsed/platform-params": "8.
|
|
33
|
-
"@tsed/typescript": "8.
|
|
29
|
+
"@tsed/barrels": "8.41.1",
|
|
30
|
+
"@tsed/di": "8.41.1",
|
|
31
|
+
"@tsed/platform-middlewares": "8.41.1",
|
|
32
|
+
"@tsed/platform-params": "8.41.1",
|
|
33
|
+
"@tsed/typescript": "8.41.1",
|
|
34
34
|
"typescript": "6.0.2",
|
|
35
35
|
"vitest": "4.1.4"
|
|
36
36
|
},
|
package/readme.md
CHANGED
|
@@ -40,26 +40,29 @@ npm install --save @tsed/platform-log-request
|
|
|
40
40
|
```ts
|
|
41
41
|
import {Configuration} from "@tsed/di";
|
|
42
42
|
import "@tsed/platform-log-request";
|
|
43
|
-
import {levels} from "@tsed/logger";
|
|
44
43
|
|
|
45
44
|
@Configuration({
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
45
|
+
logger: {
|
|
46
|
+
/**
|
|
47
|
+
* Log all incoming requests. By default, true.
|
|
48
|
+
* @optional
|
|
49
|
+
*/
|
|
50
|
+
// logRequest: true,
|
|
51
|
+
/**
|
|
52
|
+
* A function to alter the log object before it is logged.
|
|
53
|
+
* @optional
|
|
54
|
+
*/
|
|
55
|
+
// alterLog: (level, data, $ctx) => {
|
|
56
|
+
// /// see example below
|
|
57
|
+
// },
|
|
58
|
+
/**
|
|
59
|
+
* A function to log the server response.
|
|
60
|
+
* @optional
|
|
61
|
+
*/
|
|
62
|
+
// onLogResponse: ($ctx) => {
|
|
63
|
+
// /// see example below
|
|
64
|
+
// }
|
|
65
|
+
}
|
|
63
66
|
})
|
|
64
67
|
class Server {}
|
|
65
68
|
```
|
|
@@ -101,7 +104,9 @@ import "@tsed/platform-log-request";
|
|
|
101
104
|
import {customAlterLog} from "./utils/customAlterLog.js";
|
|
102
105
|
|
|
103
106
|
@Configuration({
|
|
104
|
-
|
|
107
|
+
logger: {
|
|
108
|
+
alterLog: customAlterLog
|
|
109
|
+
}
|
|
105
110
|
})
|
|
106
111
|
class Server {}
|
|
107
112
|
```
|
|
@@ -150,7 +155,9 @@ import "@tsed/platform-log-request";
|
|
|
150
155
|
import {customOnLogResponse} from "./utils/customOnLogResponse.js";
|
|
151
156
|
|
|
152
157
|
@Configuration({
|
|
153
|
-
|
|
158
|
+
logger: {
|
|
159
|
+
onLogResponse: customOnLogResponse
|
|
160
|
+
}
|
|
154
161
|
})
|
|
155
162
|
class Server {}
|
|
156
163
|
```
|