@ogcio/fastify-logging-wrapper 4.0.1 → 5.0.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.
package/CHANGELOG.md
CHANGED
|
@@ -3,14 +3,30 @@
|
|
|
3
3
|
All notable changes to this project will be documented in this file.
|
|
4
4
|
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
|
5
5
|
|
|
6
|
-
##
|
|
6
|
+
## 5.0.1 (2024-10-01)
|
|
7
7
|
|
|
8
8
|
|
|
9
9
|
### Bug Fixes
|
|
10
10
|
|
|
11
|
-
* **fastify-logging-wrapper:** installed shared errors
|
|
11
|
+
* **fastify-logging-wrapper:** installed shared errors as dep ([f77a8ba](https://github.com/ogcio/shared-node-utils/commit/f77a8ba1532627120ff0b860685c552243664f5c))
|
|
12
12
|
|
|
13
13
|
|
|
14
14
|
### Features
|
|
15
15
|
|
|
16
16
|
* **root:** startup repo ([7422a6c](https://github.com/ogcio/shared-node-utils/commit/7422a6c8a7d51722299e6cd61eebacefe2b80d6d))
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
# 5.0.0 (2024-10-01)
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
### Features
|
|
26
|
+
|
|
27
|
+
* **fastify-logging-wrapper:** added code ([6fa2068](https://github.com/ogcio/shared-node-utils/commit/6fa2068dbef70d00406065b79de1bf91aa444bea))
|
|
28
|
+
* **root:** startup repo ([7422a6c](https://github.com/ogcio/shared-node-utils/commit/7422a6c8a7d51722299e6cd61eebacefe2b80d6d))
|
|
29
|
+
|
|
30
|
+
## BREAKING CHANGES
|
|
31
|
+
|
|
32
|
+
- Moved to fastify v5.0.0
|
|
@@ -10,7 +10,8 @@ import {
|
|
|
10
10
|
} from "../../src/logging-wrapper-entities.js";
|
|
11
11
|
import assert from 'node:assert/strict';
|
|
12
12
|
|
|
13
|
-
export const DEFAULT_HOSTNAME = "localhost
|
|
13
|
+
export const DEFAULT_HOSTNAME = "localhost";
|
|
14
|
+
export const DEFAULT_PORT = 80;
|
|
14
15
|
export const DEFAULT_USER_AGENT = "lightMyRequest";
|
|
15
16
|
export const DEFAULT_REQUEST_HEADERS = {
|
|
16
17
|
"user-agent": "lightMyRequest",
|
|
@@ -75,6 +76,7 @@ export const checkExpectedRequestEntry = (params: {
|
|
|
75
76
|
assert.equal(parsed.request?.method, params.inputMethod);
|
|
76
77
|
assert.equal(parsed.request?.path, params.inputPath);
|
|
77
78
|
assert.equal(parsed.request?.hostname, DEFAULT_HOSTNAME);
|
|
79
|
+
assert.equal(parsed.request?.port, DEFAULT_PORT);
|
|
78
80
|
assert.deepStrictEqual(parsed.request?.query_params, params.inputQueryParams ?? {});
|
|
79
81
|
assert.deepStrictEqual(parsed.request?.headers, {
|
|
80
82
|
...DEFAULT_REQUEST_HEADERS,
|
|
@@ -108,6 +110,7 @@ export const checkExpectedResponseEntry = (params: {
|
|
|
108
110
|
assert.equal(parsed.request.method, params.inputMethod);
|
|
109
111
|
assert.equal(parsed.request.path, params.inputPath);
|
|
110
112
|
assert.equal(parsed.request.hostname, DEFAULT_HOSTNAME);
|
|
113
|
+
assert.equal(parsed.request.port, DEFAULT_PORT);
|
|
111
114
|
assert.deepStrictEqual(parsed.request.query_params, params.inputQueryParams ?? {});
|
|
112
115
|
assert.ok(typeof parsed.response !== "undefined");
|
|
113
116
|
assert.equal(parsed.response.status_code, params.responseStatusCode);
|
|
@@ -173,6 +176,7 @@ export const checkExpectedErrorEntry = (params: {
|
|
|
173
176
|
assert.equal(parsed.request?.method, params.inputMethod);
|
|
174
177
|
assert.equal(parsed.request?.path, params.inputPath);
|
|
175
178
|
assert.equal(parsed.request?.hostname, DEFAULT_HOSTNAME);
|
|
179
|
+
assert.equal(parsed.request?.port, DEFAULT_PORT);
|
|
176
180
|
assert.deepStrictEqual(parsed.request?.query_params, params.inputQueryParams ?? {});
|
|
177
181
|
assert.ok(typeof parsed.error !== "undefined");
|
|
178
182
|
assert.equal(parsed.error.class, params.errorClass);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ogcio/fastify-logging-wrapper",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "5.0.1",
|
|
4
4
|
"main": "dist/index.js",
|
|
5
5
|
"types": "dist/index.d.ts",
|
|
6
6
|
"type": "module",
|
|
@@ -17,9 +17,9 @@
|
|
|
17
17
|
"description": "Enable standardized log entries for each request in fastify",
|
|
18
18
|
"dependencies": {
|
|
19
19
|
"@fastify/error": "^4.0.0",
|
|
20
|
-
"@fastify/sensible": "^
|
|
20
|
+
"@fastify/sensible": "^6.0.1",
|
|
21
21
|
"@ogcio/shared-errors": "^1.0.0",
|
|
22
|
-
"fastify": "^
|
|
22
|
+
"fastify": "^5.0.0",
|
|
23
23
|
"hyperid": "^3.3.0"
|
|
24
24
|
},
|
|
25
25
|
"devDependencies": {
|
|
@@ -29,5 +29,6 @@
|
|
|
29
29
|
"type": "git",
|
|
30
30
|
"url": "git+https://github.com/ogcio/shared-node-utils.git",
|
|
31
31
|
"directory": "packages/fastify-logging-wrapper"
|
|
32
|
-
}
|
|
32
|
+
},
|
|
33
|
+
"homepage": "https://github.com/ogcio/shared-node-utils/tree/main/packages/fastify-logging-wrapper#readme"
|
|
33
34
|
}
|
|
@@ -51,7 +51,7 @@ export const initializeLoggingHooks = (server: FastifyInstance): void => {
|
|
|
51
51
|
export const getLoggingConfiguration = (
|
|
52
52
|
loggerDestination?: DestinationStream,
|
|
53
53
|
): FastifyServerOptions => ({
|
|
54
|
-
|
|
54
|
+
loggerInstance: pino(getLoggerConfiguration(), loggerDestination),
|
|
55
55
|
disableRequestLogging: true,
|
|
56
56
|
genReqId: () => hyperidInstance(),
|
|
57
57
|
requestIdLogLabel: REQUEST_ID_LOG_LABEL,
|
package/src/logging-wrapper.ts
CHANGED