@lucaapp/service-utils 1.62.4 → 1.62.6
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.
|
@@ -3,6 +3,10 @@ import { Logger } from 'pino';
|
|
|
3
3
|
import { HttpLoggerCreationOptions } from './utils';
|
|
4
4
|
export declare const ignore: (request: IncomingMessage) => boolean;
|
|
5
5
|
export declare class LoggerFactory {
|
|
6
|
-
static getLogger(logLevel: string
|
|
6
|
+
static getLogger(logLevel: string, sentryOptions?: {
|
|
7
|
+
sentryDsn?: string;
|
|
8
|
+
releaseVersion?: string;
|
|
9
|
+
minLevel?: 10 | 20 | 30 | 40 | 50;
|
|
10
|
+
}): Logger;
|
|
7
11
|
static getHttpLogger(options: HttpLoggerCreationOptions): import("pino-http").HttpLogger<IncomingMessage, ServerResponse<IncomingMessage>, never>;
|
|
8
12
|
}
|
package/dist/lib/logger/index.js
CHANGED
|
@@ -16,12 +16,44 @@ const ignore = (request) => {
|
|
|
16
16
|
};
|
|
17
17
|
exports.ignore = ignore;
|
|
18
18
|
class LoggerFactory {
|
|
19
|
-
static getLogger(logLevel) {
|
|
20
|
-
|
|
19
|
+
static getLogger(logLevel, sentryOptions) {
|
|
20
|
+
const { sentryDsn, releaseVersion, minLevel } = sentryOptions ?? {};
|
|
21
|
+
const transports = [
|
|
22
|
+
{
|
|
23
|
+
target: 'pino/file',
|
|
24
|
+
options: { destination: 1 },
|
|
25
|
+
},
|
|
26
|
+
...(sentryDsn
|
|
27
|
+
? [
|
|
28
|
+
{
|
|
29
|
+
target: 'pino-sentry-transport',
|
|
30
|
+
options: {
|
|
31
|
+
sentry: {
|
|
32
|
+
dsn: sentryDsn,
|
|
33
|
+
environment: process.env.NODE_ENV || 'development',
|
|
34
|
+
...(releaseVersion && { release: releaseVersion }),
|
|
35
|
+
},
|
|
36
|
+
withLogRecord: true,
|
|
37
|
+
tags: ['level', 'reqId'],
|
|
38
|
+
context: ['reqId'],
|
|
39
|
+
minLevel: minLevel ?? 50,
|
|
40
|
+
},
|
|
41
|
+
},
|
|
42
|
+
]
|
|
43
|
+
: []),
|
|
44
|
+
];
|
|
45
|
+
return (0, pino_1.default)({
|
|
46
|
+
level: logLevel,
|
|
47
|
+
mixin: requestTracer_1.getRequestTracerMixin,
|
|
48
|
+
transport: {
|
|
49
|
+
targets: transports,
|
|
50
|
+
},
|
|
51
|
+
});
|
|
21
52
|
}
|
|
22
53
|
static getHttpLogger(options) {
|
|
23
54
|
const { requestSerializer, responseSerializer, errorSerializer, defaultHttpLogLevel, customMessage, } = new HttpLoggerHelpers(options);
|
|
24
|
-
const
|
|
55
|
+
const { sentryOptions } = options;
|
|
56
|
+
const logger = this.getLogger(options.logLevel, sentryOptions);
|
|
25
57
|
return (0, pino_http_1.default)({
|
|
26
58
|
logger,
|
|
27
59
|
autoLogging: {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@lucaapp/service-utils",
|
|
3
|
-
"version": "1.62.
|
|
3
|
+
"version": "1.62.6",
|
|
4
4
|
"main": "dist/index.js",
|
|
5
5
|
"types": "dist/index.d.ts",
|
|
6
6
|
"files": [
|
|
@@ -20,6 +20,7 @@
|
|
|
20
20
|
"dependencies": {
|
|
21
21
|
"@asteasolutions/zod-to-openapi": "6.1.0",
|
|
22
22
|
"@hapi/boom": "^10.0.0",
|
|
23
|
+
"@sentry/node": "^9.3.0",
|
|
23
24
|
"@tsconfig/node18": "1.0.1",
|
|
24
25
|
"@types/express": "4.17.15",
|
|
25
26
|
"@types/express-serve-static-core": "^4.17.43",
|
|
@@ -38,6 +39,7 @@
|
|
|
38
39
|
"moment-timezone": "^0.5.44",
|
|
39
40
|
"negotiator": "^0.6.3",
|
|
40
41
|
"pino-http": "9.0.0",
|
|
42
|
+
"pino-sentry-transport": "^1.5.0",
|
|
41
43
|
"prom-client": "14.1.0",
|
|
42
44
|
"response-time": "2.3.3",
|
|
43
45
|
"sequelize": "6.32.0",
|
|
@@ -56,7 +58,7 @@
|
|
|
56
58
|
"@types/uuid": "^8.3.4",
|
|
57
59
|
"@typescript-eslint/eslint-plugin": "^7.15.0",
|
|
58
60
|
"@typescript-eslint/parser": "^7.15.0",
|
|
59
|
-
"@vitest/coverage-v8": "
|
|
61
|
+
"@vitest/coverage-v8": "3.0.4",
|
|
60
62
|
"conventional-changelog-conventionalcommits": "^5.0.0",
|
|
61
63
|
"eslint": "8.57.0",
|
|
62
64
|
"eslint-plugin-prettier": "4.2.1",
|
|
@@ -68,7 +70,7 @@
|
|
|
68
70
|
"supertest": "^6.3.3",
|
|
69
71
|
"typescript": "5.5.3",
|
|
70
72
|
"vite-tsconfig-paths": "4.3.2",
|
|
71
|
-
"vitest": "
|
|
73
|
+
"vitest": "3.0.5"
|
|
72
74
|
},
|
|
73
75
|
"resolutions": {
|
|
74
76
|
"yaml": "2.2.2",
|
|
@@ -79,6 +81,7 @@
|
|
|
79
81
|
"rollup": "4.22.4",
|
|
80
82
|
"cookie": ">= 0.7.0",
|
|
81
83
|
"string-width": "4.2.3",
|
|
82
|
-
"@types/express": "4.17.15"
|
|
84
|
+
"@types/express": "4.17.15",
|
|
85
|
+
"esbuild": "^0.25.0"
|
|
83
86
|
}
|
|
84
87
|
}
|