@cargolift-cdi/common 1.0.41 → 1.0.43
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/README.md +36 -0
- package/dist/index.d.ts +1 -2
- package/dist/index.js +1 -2
- package/dist/index.js.map +1 -1
- package/dist/logger/logger.async-context.d.ts +10 -0
- package/dist/logger/logger.async-context.js +20 -0
- package/dist/logger/logger.async-context.js.map +1 -0
- package/dist/logger/logger.service.d.ts +1 -18
- package/dist/logger/logger.service.js +48 -59
- package/dist/logger/logger.service.js.map +1 -1
- package/dist/middleware/api-logger.middleware.js +36 -44
- package/dist/middleware/api-logger.middleware.js.map +1 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -94,6 +94,42 @@ throw new GenericBusinessError('Falha no provedor', {
|
|
|
94
94
|
|
|
95
95
|
Observação: existem classes internas adicionais (ex.: `ApplicationError`, `GenericApplicationError`) que podem evoluir; utilize apenas a API pública acima para evitar quebras.
|
|
96
96
|
|
|
97
|
+
## Contexto de Logs com AsyncLocalStorage (v2)
|
|
98
|
+
|
|
99
|
+
A partir da versão que introduz esta seção, o `LoggerContextService` passou a ser singleton (escopo DEFAULT) e o isolamento por requisição/mensagem é garantido via `AsyncLocalStorage`.
|
|
100
|
+
|
|
101
|
+
Benefícios:
|
|
102
|
+
- Menos alocações de instâncias (melhor para alto throughput)
|
|
103
|
+
- Propagação automática de contexto por callbacks/promises sem passar manualmente
|
|
104
|
+
- Publishers/clients apenas usam `logger.getContext()`
|
|
105
|
+
|
|
106
|
+
Helpers exportados:
|
|
107
|
+
```ts
|
|
108
|
+
import { runWithLoggerContext, getLoggerContext, updateLoggerContext } from '@cargolift-cdi/common';
|
|
109
|
+
|
|
110
|
+
runWithLoggerContext({ correlation_id: 'abc' }, () => {
|
|
111
|
+
// Tudo aqui dentro (e awaits) mantém o contexto
|
|
112
|
+
});
|
|
113
|
+
```
|
|
114
|
+
|
|
115
|
+
Fluxo HTTP (middleware `APILoggerMiddleware`):
|
|
116
|
+
1. Abre `runWithLoggerContext({})`
|
|
117
|
+
2. Chama `logger.setContextRequest(req)` (gera/propaga `correlation_id` e `trace`)
|
|
118
|
+
3. Todos os logs subsequentes compartilham o mesmo contexto
|
|
119
|
+
|
|
120
|
+
Fluxo RabbitMQ (consumer):
|
|
121
|
+
1. Cria um child logger a partir dos headers da mensagem (`childFromRabbit`)
|
|
122
|
+
2. Semeia o ALS com `runWithLoggerContext(child.getContext(), processMessage)`
|
|
123
|
+
3. Dentro do processamento usa-se o `logger` base normalmente
|
|
124
|
+
|
|
125
|
+
Caso precise anexar dados adicionais no meio da execução:
|
|
126
|
+
```ts
|
|
127
|
+
updateLoggerContext({ caller_info: { type: 'user', id: 'u-1' } });
|
|
128
|
+
```
|
|
129
|
+
|
|
130
|
+
Se um log for emitido fora de um escopo ALS (ex.: antes de bootstrap), o logger ainda funcionará, porém sem `correlation_id` fixo (um novo poderá ser gerado quando o contexto for definido).
|
|
131
|
+
|
|
132
|
+
|
|
97
133
|
|
|
98
134
|
## Detalhes das classes
|
|
99
135
|
|
package/dist/index.d.ts
CHANGED
|
@@ -8,8 +8,7 @@ export * from './logger/logger.module.js';
|
|
|
8
8
|
export * from './logger/logger.interface.js';
|
|
9
9
|
export * from './logger/app-logger.module.js';
|
|
10
10
|
export * from './logger/app-logger.token.js';
|
|
11
|
-
export * from './logger/
|
|
12
|
-
export * from './logger/app-logger.token.js';
|
|
11
|
+
export * from './logger/logger.async-context.js';
|
|
13
12
|
export * from './auth/auth.module.js';
|
|
14
13
|
export * from './auth/auth.guard.js';
|
|
15
14
|
export * from './auth/roles.decorator.js';
|
package/dist/index.js
CHANGED
|
@@ -8,8 +8,7 @@ export * from './logger/logger.module.js';
|
|
|
8
8
|
export * from './logger/logger.interface.js';
|
|
9
9
|
export * from './logger/app-logger.module.js';
|
|
10
10
|
export * from './logger/app-logger.token.js';
|
|
11
|
-
export * from './logger/
|
|
12
|
-
export * from './logger/app-logger.token.js';
|
|
11
|
+
export * from './logger/logger.async-context.js';
|
|
13
12
|
export * from './auth/auth.module.js';
|
|
14
13
|
export * from './auth/auth.guard.js';
|
|
15
14
|
export * from './auth/roles.decorator.js';
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AACA,cAAc,oCAAoC,CAAC;AAGnD,cAAc,uCAAuC,CAAC;AAGtD,cAAc,4BAA4B,CAAC;AAC3C,cAAc,sCAAsC,CAAC;AACrD,cAAc,+BAA+B,CAAC;AAG9C,cAAc,4BAA4B,CAAC;AAC3C,cAAc,2BAA2B,CAAC;AAC1C,cAAc,8BAA8B,CAAC;AAC7C,cAAc,+BAA+B,CAAC;AAC9C,cAAc,8BAA8B,CAAC;AAC7C,cAAc
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AACA,cAAc,oCAAoC,CAAC;AAGnD,cAAc,uCAAuC,CAAC;AAGtD,cAAc,4BAA4B,CAAC;AAC3C,cAAc,sCAAsC,CAAC;AACrD,cAAc,+BAA+B,CAAC;AAG9C,cAAc,4BAA4B,CAAC;AAC3C,cAAc,2BAA2B,CAAC;AAC1C,cAAc,8BAA8B,CAAC;AAC7C,cAAc,+BAA+B,CAAC;AAC9C,cAAc,8BAA8B,CAAC;AAC7C,cAAc,kCAAkC,CAAC;AAGjD,cAAc,uBAAuB,CAAC;AACtC,cAAc,sBAAsB,CAAC;AACrC,cAAc,2BAA2B,CAAA"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { AsyncLocalStorage } from 'node:async_hooks';
|
|
2
|
+
import { LogContext } from './logger.interface.js';
|
|
3
|
+
export interface LoggerAsyncStore {
|
|
4
|
+
context: Partial<LogContext>;
|
|
5
|
+
}
|
|
6
|
+
export declare const loggerAsyncStorage: AsyncLocalStorage<LoggerAsyncStore>;
|
|
7
|
+
export declare function getLoggerStore(): LoggerAsyncStore | undefined;
|
|
8
|
+
export declare function getLoggerContext(): Partial<LogContext>;
|
|
9
|
+
export declare function updateLoggerContext(partial: Partial<LogContext>): Partial<LogContext>;
|
|
10
|
+
export declare function runWithLoggerContext<T>(initial: Partial<LogContext>, fn: () => T): T;
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { AsyncLocalStorage } from 'node:async_hooks';
|
|
2
|
+
export const loggerAsyncStorage = new AsyncLocalStorage();
|
|
3
|
+
export function getLoggerStore() {
|
|
4
|
+
return loggerAsyncStorage.getStore();
|
|
5
|
+
}
|
|
6
|
+
export function getLoggerContext() {
|
|
7
|
+
return { ...(getLoggerStore()?.context || {}) };
|
|
8
|
+
}
|
|
9
|
+
export function updateLoggerContext(partial) {
|
|
10
|
+
const store = loggerAsyncStorage.getStore();
|
|
11
|
+
if (!store) {
|
|
12
|
+
return { ...partial };
|
|
13
|
+
}
|
|
14
|
+
store.context = { ...store.context, ...partial };
|
|
15
|
+
return { ...store.context };
|
|
16
|
+
}
|
|
17
|
+
export function runWithLoggerContext(initial, fn) {
|
|
18
|
+
return loggerAsyncStorage.run({ context: { ...initial } }, fn);
|
|
19
|
+
}
|
|
20
|
+
//# sourceMappingURL=logger.async-context.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"logger.async-context.js","sourceRoot":"","sources":["../../src/logger/logger.async-context.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,MAAM,kBAAkB,CAAC;AAYrD,MAAM,CAAC,MAAM,kBAAkB,GAAG,IAAI,iBAAiB,EAAoB,CAAC;AAK5E,MAAM,UAAU,cAAc;IAC5B,OAAO,kBAAkB,CAAC,QAAQ,EAAE,CAAC;AACvC,CAAC;AAGD,MAAM,UAAU,gBAAgB;IAC9B,OAAO,EAAE,GAAG,CAAC,cAAc,EAAE,EAAE,OAAO,IAAI,EAAE,CAAC,EAAE,CAAC;AAClD,CAAC;AAGD,MAAM,UAAU,mBAAmB,CAAC,OAA4B;IAC9D,MAAM,KAAK,GAAG,kBAAkB,CAAC,QAAQ,EAAE,CAAC;IAC5C,IAAI,CAAC,KAAK,EAAE,CAAC;QAEX,OAAO,EAAE,GAAG,OAAO,EAAE,CAAC;IACxB,CAAC;IACD,KAAK,CAAC,OAAO,GAAG,EAAE,GAAG,KAAK,CAAC,OAAO,EAAE,GAAG,OAAO,EAAE,CAAC;IACjD,OAAO,EAAE,GAAG,KAAK,CAAC,OAAO,EAAE,CAAC;AAC9B,CAAC;AAGD,MAAM,UAAU,oBAAoB,CAAI,OAA4B,EAAE,EAAW;IAC/E,OAAO,kBAAkB,CAAC,GAAG,CAAC,EAAE,OAAO,EAAE,EAAE,GAAG,OAAO,EAAE,EAAE,EAAE,EAAE,CAAC,CAAC;AACjE,CAAC"}
|
|
@@ -3,7 +3,6 @@ import { ApplicationInfo, LogContext, LogTrace } from './logger.interface.js';
|
|
|
3
3
|
import type { RabbitMQMessage } from '@cargolift-cdi/types';
|
|
4
4
|
export declare class LoggerContextService implements LoggerService {
|
|
5
5
|
private pinoLogger;
|
|
6
|
-
private context;
|
|
7
6
|
constructor();
|
|
8
7
|
setDefaultContext(req?: any, rabbitMQMessage?: RabbitMQMessage, context?: LogContext): void;
|
|
9
8
|
setContextRequest(req: any, context?: LogContext): void;
|
|
@@ -43,21 +42,5 @@ export declare class LoggerContextService implements LoggerService {
|
|
|
43
42
|
businessError: (message: string, extra?: Record<string, any>) => void;
|
|
44
43
|
businessWarn: (message: string, extra?: Record<string, any>) => void;
|
|
45
44
|
};
|
|
46
|
-
|
|
47
|
-
getContext: () => {
|
|
48
|
-
correlation_id?: string;
|
|
49
|
-
trace?: LogTrace[];
|
|
50
|
-
producer?: string;
|
|
51
|
-
application?: ApplicationInfo;
|
|
52
|
-
caller_info?: import("./logger.interface.js").CallerInfo;
|
|
53
|
-
error?: import("./logger.interface.js").Error;
|
|
54
|
-
};
|
|
55
|
-
info: (message: string, extra?: Record<string, any>) => void;
|
|
56
|
-
debug: (message: string, extra?: Record<string, any>) => void;
|
|
57
|
-
log: (message: string, extra?: Record<string, any>) => void;
|
|
58
|
-
warn: (message: string, extra?: Record<string, any>) => void;
|
|
59
|
-
error: (message: string, errorObj?: Record<string, any>, extra?: Record<string, any>) => void;
|
|
60
|
-
businessError: (message: string, extra?: Record<string, any>) => void;
|
|
61
|
-
businessWarn: (message: string, extra?: Record<string, any>) => void;
|
|
62
|
-
};
|
|
45
|
+
buildRabbitContext(msg: RabbitMQMessage, staticBindings?: Record<string, any>): Partial<LogContext>;
|
|
63
46
|
}
|
|
@@ -10,9 +10,9 @@ var __metadata = (this && this.__metadata) || function (k, v) {
|
|
|
10
10
|
import { Injectable, Scope } from '@nestjs/common';
|
|
11
11
|
import pino from 'pino';
|
|
12
12
|
import { v4 as uuidv4 } from 'uuid';
|
|
13
|
+
import { getLoggerContext, updateLoggerContext } from './logger.async-context.js';
|
|
13
14
|
let LoggerContextService = class LoggerContextService {
|
|
14
15
|
constructor() {
|
|
15
|
-
this.context = {};
|
|
16
16
|
const transportOptions = {
|
|
17
17
|
target: 'pino-pretty',
|
|
18
18
|
options: {
|
|
@@ -37,67 +37,62 @@ let LoggerContextService = class LoggerContextService {
|
|
|
37
37
|
this.setContext(context, undefined, rabbitMQMessage);
|
|
38
38
|
}
|
|
39
39
|
setContext(context, req, rabbitMQMessage) {
|
|
40
|
-
let trace = [];
|
|
41
40
|
const xTrace = req?.headers?.['x-trace'] || rabbitMQMessage?.properties?.headers?.['x-trace'];
|
|
42
41
|
const xCorrelation = req?.correlationId || req?.headers?.['x-correlation-id'] || rabbitMQMessage?.properties?.headers?.['x-correlation-id'];
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
this.context.producer = this.context.producer || (req ? 'api' : rabbitMQMessage ? 'rabbitmq' : 'system');
|
|
50
|
-
if (!this.context.application) {
|
|
51
|
-
this.context.application = {
|
|
42
|
+
const current = getLoggerContext();
|
|
43
|
+
const base = { ...current, ...(context || {}) };
|
|
44
|
+
base.correlation_id = base.correlation_id || context?.correlation_id || xCorrelation || uuidv4();
|
|
45
|
+
base.producer = base.producer || (req ? 'api' : rabbitMQMessage ? 'rabbitmq' : 'system');
|
|
46
|
+
if (!base.application) {
|
|
47
|
+
base.application = {
|
|
52
48
|
name: process.env.npm_package_name,
|
|
53
|
-
function: context
|
|
54
|
-
action: context
|
|
49
|
+
function: context?.application?.function || req?.originalUrl || req?.url || rabbitMQMessage?.fields?.routingKey || rabbitMQMessage?.properties?.headers?.pattern || 'unknown',
|
|
50
|
+
action: context?.application?.action || req?.method || rabbitMQMessage?.properties?.headers?.action || rabbitMQMessage?.fields?.routingKey || undefined,
|
|
55
51
|
method: req?.method || undefined,
|
|
56
52
|
};
|
|
57
53
|
}
|
|
54
|
+
let incomingTrace = Array.isArray(base.trace) ? [...base.trace] : [];
|
|
58
55
|
if (xTrace) {
|
|
59
56
|
try {
|
|
60
57
|
const traceObj = typeof xTrace === 'string' ? JSON.parse(xTrace) : xTrace;
|
|
61
58
|
if (Array.isArray(traceObj)) {
|
|
62
59
|
for (const item of traceObj) {
|
|
63
|
-
if (item && typeof item === 'object')
|
|
64
|
-
|
|
65
|
-
}
|
|
60
|
+
if (item && typeof item === 'object')
|
|
61
|
+
incomingTrace.push(item);
|
|
66
62
|
}
|
|
67
63
|
}
|
|
68
|
-
else if (typeof traceObj === 'object'
|
|
69
|
-
|
|
64
|
+
else if (traceObj && typeof traceObj === 'object') {
|
|
65
|
+
incomingTrace.push(traceObj);
|
|
70
66
|
}
|
|
71
67
|
}
|
|
72
|
-
catch
|
|
73
|
-
trace = [];
|
|
74
|
-
}
|
|
68
|
+
catch { }
|
|
75
69
|
}
|
|
76
|
-
|
|
77
|
-
application:
|
|
78
|
-
function:
|
|
70
|
+
incomingTrace.push({
|
|
71
|
+
application: base.application.name,
|
|
72
|
+
function: base.application.function,
|
|
79
73
|
timestamp: new Date().toISOString(),
|
|
80
74
|
});
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
this.context.trace = [];
|
|
75
|
+
base.trace = incomingTrace;
|
|
76
|
+
updateLoggerContext(base);
|
|
84
77
|
if (req) {
|
|
85
|
-
req.correlationId =
|
|
86
|
-
req.logContext = { ...
|
|
87
|
-
req.producer =
|
|
78
|
+
req.correlationId = base.correlation_id;
|
|
79
|
+
req.logContext = { ...base };
|
|
80
|
+
req.producer = base.producer;
|
|
88
81
|
}
|
|
89
82
|
}
|
|
90
83
|
getContext() {
|
|
91
|
-
return
|
|
84
|
+
return getLoggerContext();
|
|
92
85
|
}
|
|
93
86
|
isContextSet() {
|
|
94
|
-
|
|
87
|
+
const ctx = getLoggerContext();
|
|
88
|
+
return !!(ctx && ctx.application && ctx.correlation_id);
|
|
95
89
|
}
|
|
96
90
|
buildLog(message, logType, extraContext = {}) {
|
|
91
|
+
const ctx = getLoggerContext();
|
|
97
92
|
return {
|
|
98
93
|
message,
|
|
99
|
-
logType
|
|
100
|
-
...
|
|
94
|
+
logType,
|
|
95
|
+
...ctx,
|
|
101
96
|
...extraContext,
|
|
102
97
|
};
|
|
103
98
|
}
|
|
@@ -144,7 +139,7 @@ let LoggerContextService = class LoggerContextService {
|
|
|
144
139
|
merged.correlation_id = uuidv4();
|
|
145
140
|
}
|
|
146
141
|
if (!merged.producer) {
|
|
147
|
-
merged.producer =
|
|
142
|
+
merged.producer = baseSnapshot.producer || 'system';
|
|
148
143
|
}
|
|
149
144
|
if (options.appendTraceStep) {
|
|
150
145
|
const traceCopy = Array.isArray(baseSnapshot.trace) ? [...baseSnapshot.trace] : [];
|
|
@@ -188,47 +183,41 @@ let LoggerContextService = class LoggerContextService {
|
|
|
188
183
|
};
|
|
189
184
|
return facade;
|
|
190
185
|
}
|
|
191
|
-
|
|
186
|
+
buildRabbitContext(msg, staticBindings = {}) {
|
|
192
187
|
const headers = msg?.properties?.headers || {};
|
|
193
188
|
const correlation = headers['x-correlation-id'] || headers['correlation-id'] || msg.properties?.correlationId;
|
|
194
189
|
const traceHeader = headers['x-trace'];
|
|
195
|
-
const producer = headers['x-producer'] || msg.properties?.producer;
|
|
196
|
-
let
|
|
190
|
+
const producer = headers['x-producer'] || msg.properties?.producer || 'rabbitmq';
|
|
191
|
+
let trace = [];
|
|
197
192
|
if (traceHeader) {
|
|
198
193
|
try {
|
|
199
194
|
const parsed = typeof traceHeader === 'string' ? JSON.parse(traceHeader) : traceHeader;
|
|
200
195
|
if (Array.isArray(parsed))
|
|
201
|
-
|
|
196
|
+
trace = parsed.filter(Boolean);
|
|
202
197
|
}
|
|
203
198
|
catch { }
|
|
204
199
|
}
|
|
205
|
-
const
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
200
|
+
const functionName = staticBindings.queue || headers?.pattern || msg.fields?.routingKey || 'rabbitmq-message';
|
|
201
|
+
trace.push({
|
|
202
|
+
application: process.env.npm_package_name || 'app',
|
|
203
|
+
function: functionName,
|
|
204
|
+
timestamp: new Date().toISOString(),
|
|
205
|
+
});
|
|
206
|
+
return {
|
|
207
|
+
correlation_id: correlation || uuidv4(),
|
|
208
|
+
producer,
|
|
209
|
+
trace,
|
|
209
210
|
application: {
|
|
210
|
-
name:
|
|
211
|
-
function:
|
|
211
|
+
name: process.env.npm_package_name,
|
|
212
|
+
function: functionName,
|
|
212
213
|
action: msg.fields?.routingKey || undefined,
|
|
213
|
-
method: undefined,
|
|
214
214
|
},
|
|
215
|
+
...staticBindings,
|
|
215
216
|
};
|
|
216
|
-
return this.child({
|
|
217
|
-
contextMerge,
|
|
218
|
-
extraBindings: {
|
|
219
|
-
rabbitmq: {
|
|
220
|
-
queue: staticBindings.queue || msg.fields?.routingKey,
|
|
221
|
-
deliveryTag: msg.fields?.deliveryTag,
|
|
222
|
-
message_id: msg.properties?.messageId,
|
|
223
|
-
},
|
|
224
|
-
...staticBindings,
|
|
225
|
-
},
|
|
226
|
-
appendTraceStep: true,
|
|
227
|
-
});
|
|
228
217
|
}
|
|
229
218
|
};
|
|
230
219
|
LoggerContextService = __decorate([
|
|
231
|
-
Injectable({ scope: Scope.
|
|
220
|
+
Injectable({ scope: Scope.DEFAULT }),
|
|
232
221
|
__metadata("design:paramtypes", [])
|
|
233
222
|
], LoggerContextService);
|
|
234
223
|
export { LoggerContextService };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"logger.service.js","sourceRoot":"","sources":["../../src/logger/logger.service.ts"],"names":[],"mappings":";;;;;;;;;AAAA,OAAO,EAAE,UAAU,
|
|
1
|
+
{"version":3,"file":"logger.service.js","sourceRoot":"","sources":["../../src/logger/logger.service.ts"],"names":[],"mappings":";;;;;;;;;AAAA,OAAO,EAAE,UAAU,EAAiB,KAAK,EAAE,MAAM,gBAAgB,CAAC;AAClE,OAAO,IAAwC,MAAM,MAAM,CAAC;AAE5D,OAAO,EAAE,EAAE,IAAI,MAAM,EAAE,MAAM,MAAM,CAAC;AAEpC,OAAO,EAAE,gBAAgB,EAAE,mBAAmB,EAAE,MAAM,2BAA2B,CAAC;AAQ3E,IAAM,oBAAoB,GAA1B,MAAM,oBAAoB;IAG/B;QACE,MAAM,gBAAgB,GAA2B;YAC/C,MAAM,EAAE,aAAa;YACrB,OAAO,EAAE;gBACP,QAAQ,EAAE,IAAI;gBACd,aAAa,EAAE,2BAA2B;gBAC1C,MAAM,EAAE,OAAO,CAAC,GAAG,CAAC,gBAAgB,IAAI,uDAAuD;gBAC/F,aAAa,EAAE,WAAW;aAC3B;SACF,CAAA;QACD,IAAI,CAAC,UAAU,GAAG,IAAI,CAAC;YACrB,KAAK,EAAE,OAAO,CAAC,GAAG,CAAC,SAAS,IAAI,MAAM;YACtC,SAAS,EAAE,OAAO,CAAC,GAAG,CAAC,QAAQ,KAAK,aAAa,CAAC,CAAC,CAAC,gBAAgB,CAAC,CAAC,CAAC,SAAS;SACjF,CAAC,CAAC;IACL,CAAC;IAMD,iBAAiB,CAAC,GAAS,EAAE,eAAiC,E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C;gBACvF,IAAI,KAAK,CAAC,OAAO,CAAC,MAAM,CAAC;oBAAE,KAAK,GAAG,MAAM,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC;YAC5D,CAAC;YAAC,MAAM,CAAC,CAAc,CAAC;QAC1B,CAAC;QAED,MAAM,YAAY,GAAG,cAAc,CAAC,KAAK,IAAI,OAAO,EAAE,OAAO,IAAI,GAAG,CAAC,MAAM,EAAE,UAAU,IAAI,kBAAkB,CAAC;QAC9G,KAAK,CAAC,IAAI,CAAC;YACT,WAAW,EAAE,OAAO,CAAC,GAAG,CAAC,gBAAgB,IAAI,KAAK;YAClD,QAAQ,EAAE,YAAY;YACtB,SAAS,EAAE,IAAI,IAAI,EAAE,CAAC,WAAW,EAAE;SACpC,CAAC,CAAC;QAEH,OAAO;YACL,cAAc,EAAE,WAAW,IAAI,MAAM,EAAE;YACvC,QAAQ;YACR,KAAK;YACL,WAAW,EAAE;gBACX,IAAI,EAAE,OAAO,CAAC,GAAG,CAAC,gBAAgB;gBAClC,QAAQ,EAAE,YAAY;gBACtB,MAAM,EAAE,GAAG,CAAC,MAAM,EAAE,UAAU,IAAI,SAAS;aAC5C;YACD,GAAG,cAAc;SAClB,CAAC;IACJ,CAAC;CACF,CAAA;AAnVY,oBAAoB;IADhC,UAAU,CAAC,EAAE,KAAK,EAAE,KAAK,CAAC,OAAO,EAAE,CAAC;;GACxB,oBAAoB,CAmVhC"}
|
|
@@ -10,6 +10,7 @@ var __metadata = (this && this.__metadata) || function (k, v) {
|
|
|
10
10
|
import { Injectable } from '@nestjs/common';
|
|
11
11
|
import { ModuleRef, ContextIdFactory } from '@nestjs/core';
|
|
12
12
|
import { LoggerContextService } from '../logger/logger.service.js';
|
|
13
|
+
import { runWithLoggerContext } from '../logger/logger.async-context.js';
|
|
13
14
|
let APILoggerMiddleware = class APILoggerMiddleware {
|
|
14
15
|
constructor(moduleRef) {
|
|
15
16
|
this.moduleRef = moduleRef;
|
|
@@ -18,62 +19,53 @@ let APILoggerMiddleware = class APILoggerMiddleware {
|
|
|
18
19
|
const contextId = ContextIdFactory.getByRequest(req);
|
|
19
20
|
const logger = await this.moduleRef.resolve(LoggerContextService, contextId, { strict: false });
|
|
20
21
|
const startHr = typeof process.hrtime.bigint === 'function' ? process.hrtime.bigint() : null;
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
logger.
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
...logger.getContext().application || {},
|
|
29
|
-
action: 'request',
|
|
30
|
-
},
|
|
31
|
-
data: {
|
|
32
|
-
request: {
|
|
33
|
-
method: req?.method,
|
|
34
|
-
path: url,
|
|
35
|
-
},
|
|
36
|
-
payload: this.safeBody(req?.body),
|
|
37
|
-
},
|
|
38
|
-
});
|
|
39
|
-
res?.on?.('finish', () => {
|
|
40
|
-
const endHr = typeof process.hrtime.bigint === 'function' ? process.hrtime.bigint() : null;
|
|
41
|
-
const durationMs = startHr && endHr ? Number((endHr - startHr) / BigInt(1_000_000)) : undefined;
|
|
42
|
-
logger.info(`HTTP ${req?.method} ${url} [${res?.statusCode}] - Response sent`, {
|
|
22
|
+
const url = req?.originalUrl || req?.url;
|
|
23
|
+
runWithLoggerContext({}, () => {
|
|
24
|
+
try {
|
|
25
|
+
if (!logger.isContextSet()) {
|
|
26
|
+
logger.setContextRequest(req);
|
|
27
|
+
}
|
|
28
|
+
logger.info(`HTTP ${req?.method} ${url} [${res?.statusCode}] - Request received`, {
|
|
43
29
|
application: {
|
|
44
30
|
...logger.getContext().application || {},
|
|
45
|
-
action: '
|
|
31
|
+
action: 'request',
|
|
46
32
|
},
|
|
47
33
|
data: {
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
durationMs,
|
|
51
|
-
body: res?.json,
|
|
52
|
-
},
|
|
53
|
-
payload: this.safeBody(res?.json),
|
|
34
|
+
request: { method: req?.method, path: url },
|
|
35
|
+
payload: this.safeBody(req?.body),
|
|
54
36
|
},
|
|
55
37
|
});
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
38
|
+
res?.on?.('finish', () => {
|
|
39
|
+
const endHr = typeof process.hrtime.bigint === 'function' ? process.hrtime.bigint() : null;
|
|
40
|
+
const durationMs = startHr && endHr ? Number((endHr - startHr) / BigInt(1_000_000)) : undefined;
|
|
41
|
+
logger.info(`HTTP ${req?.method} ${url} [${res?.statusCode}] - Response sent`, {
|
|
42
|
+
application: {
|
|
43
|
+
...logger.getContext().application || {},
|
|
44
|
+
action: 'response',
|
|
45
|
+
},
|
|
46
|
+
data: {
|
|
47
|
+
response: { statusCode: res?.statusCode, durationMs },
|
|
48
|
+
},
|
|
49
|
+
});
|
|
50
|
+
});
|
|
51
|
+
}
|
|
52
|
+
catch {
|
|
53
|
+
}
|
|
54
|
+
finally {
|
|
55
|
+
next();
|
|
56
|
+
}
|
|
57
|
+
});
|
|
63
58
|
}
|
|
64
59
|
safeBody(body) {
|
|
65
60
|
if (!body || typeof body !== 'object')
|
|
66
61
|
return body;
|
|
67
62
|
const redact = new Set(['password', 'senha', 'token', 'access_token', 'authorization']);
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
const src = Array.isArray(body) ? { array: body } : body;
|
|
71
|
-
for (const [k, v] of Object.entries(src)) {
|
|
72
|
-
out[k] = redact.has(k.toLowerCase()) ? '***' : v;
|
|
73
|
-
}
|
|
63
|
+
if (Array.isArray(body)) {
|
|
64
|
+
return body.slice(0, 20).map((item) => (typeof item === 'object' ? this.safeBody(item) : item));
|
|
74
65
|
}
|
|
75
|
-
|
|
76
|
-
|
|
66
|
+
const out = {};
|
|
67
|
+
for (const [k, v] of Object.entries(body)) {
|
|
68
|
+
out[k] = redact.has(k.toLowerCase()) ? '***' : (typeof v === 'object' && v !== null ? this.safeBody(v) : v);
|
|
77
69
|
}
|
|
78
70
|
return out;
|
|
79
71
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"api-logger.middleware.js","sourceRoot":"","sources":["../../src/middleware/api-logger.middleware.ts"],"names":[],"mappings":";;;;;;;;;AAAA,OAAO,EAAE,UAAU,EAAkB,MAAM,gBAAgB,CAAC;AAC5D,OAAO,EAAE,SAAS,EAAE,gBAAgB,EAAE,MAAM,cAAc,CAAC;AAC3D,OAAO,EAAE,oBAAoB,EAAE,MAAM,6BAA6B,CAAC;
|
|
1
|
+
{"version":3,"file":"api-logger.middleware.js","sourceRoot":"","sources":["../../src/middleware/api-logger.middleware.ts"],"names":[],"mappings":";;;;;;;;;AAAA,OAAO,EAAE,UAAU,EAAkB,MAAM,gBAAgB,CAAC;AAC5D,OAAO,EAAE,SAAS,EAAE,gBAAgB,EAAE,MAAM,cAAc,CAAC;AAC3D,OAAO,EAAE,oBAAoB,EAAE,MAAM,6BAA6B,CAAC;AACnE,OAAO,EAAE,oBAAoB,EAAyC,MAAM,mCAAmC,CAAC;AAGzG,IAAM,mBAAmB,GAAzB,MAAM,mBAAmB;IAC9B,YAA6B,SAAoB;QAApB,cAAS,GAAT,SAAS,CAAW;IAAI,CAAC;IAEtD,KAAK,CAAC,GAAG,CAAC,GAAQ,EAAE,GAAQ,EAAE,IAAc;QAC1C,MAAM,SAAS,GAAG,gBAAgB,CAAC,YAAY,CAAC,GAAG,CAAC,CAAC;QACrD,MAAM,MAAM,GAAG,MAAM,IAAI,CAAC,SAAS,CAAC,OAAO,CAAC,oBAAoB,EAAE,SAAS,EAAE,EAAE,MAAM,EAAE,KAAK,EAAE,CAAC,CAAC;QAEhG,MAAM,OAAO,GAAG,OAAO,OAAO,CAAC,MAAM,CAAC,MAAM,KAAK,UAAU,CAAC,CAAC,CAAC,OAAO,CAAC,MAAM,CAAC,MAAM,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC;QAC7F,MAAM,GAAG,GAAG,GAAG,EAAE,WAAW,IAAI,GAAG,EAAE,GAAG,CAAC;QAGzC,oBAAoB,CAAC,EAAE,EAAE,GAAG,EAAE;YAC5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