Compare commits
No commits in common. "adaedbe5e943bb32f4f9ba1707a9baef70ac074d" and "ef99641f2815731aed2bee34bb576a2e04584174" have entirely different histories.
adaedbe5e9
...
ef99641f28
@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "nestlogged-fastify",
|
"name": "nestlogged-fastify",
|
||||||
"version": "3.3.1",
|
"version": "3.3.0",
|
||||||
"description": "A NestJS Logger Decorator Library With Fastify Support",
|
"description": "A NestJS Logger Decorator Library With Fastify Support",
|
||||||
"main": "./lib/index.js",
|
"main": "./lib/index.js",
|
||||||
"types": "./lib/index.d.ts",
|
"types": "./lib/index.d.ts",
|
||||||
|
@ -9,6 +9,7 @@ import {
|
|||||||
} from 'nestlogged/lib/logged/utils';
|
} from 'nestlogged/lib/logged/utils';
|
||||||
import { objectContainedLogSync, getItemByPathSync } from 'nestlogged/lib/internals/utils';
|
import { objectContainedLogSync, getItemByPathSync } from 'nestlogged/lib/internals/utils';
|
||||||
import { ScopedLogger } from 'nestlogged/lib/logger';
|
import { ScopedLogger } from 'nestlogged/lib/logger';
|
||||||
|
import { kRequestPayloadStream } from 'fastify/lib/symbols';
|
||||||
|
|
||||||
interface FunctionMetadata {
|
interface FunctionMetadata {
|
||||||
scopedLoggerInjectableParam?: number;
|
scopedLoggerInjectableParam?: number;
|
||||||
@ -78,7 +79,7 @@ export function overrideBuild<F extends Array<any>, R>(
|
|||||||
'Cannot inject logger: Request type is not http',
|
'Cannot inject logger: Request type is not http',
|
||||||
);
|
);
|
||||||
} else {
|
} else {
|
||||||
let req = ctx.switchToHttp().getRequest()['raw'];
|
let req = ctx.switchToHttp().getRequest()[kRequestPayloadStream];
|
||||||
if (req[REQUEST_LOG_ID] === undefined) {
|
if (req[REQUEST_LOG_ID] === undefined) {
|
||||||
req[REQUEST_LOG_ID] = ScopedLogger.createScopeId();
|
req[REQUEST_LOG_ID] = ScopedLogger.createScopeId();
|
||||||
}
|
}
|
||||||
@ -100,7 +101,7 @@ export function overrideBuild<F extends Array<any>, R>(
|
|||||||
);
|
);
|
||||||
} else if (type === 'route') {
|
} else if (type === 'route') {
|
||||||
// args[metadatas.scopedLoggerInjectableParam] is now Request object, thanks to code in @LoggedRoute!!!!
|
// args[metadatas.scopedLoggerInjectableParam] is now Request object, thanks to code in @LoggedRoute!!!!
|
||||||
let req = args[metadatas.scopedLoggerInjectableParam]['raw'];
|
let req = args[metadatas.scopedLoggerInjectableParam][kRequestPayloadStream];
|
||||||
if (req[REQUEST_LOG_ID] === undefined) {
|
if (req[REQUEST_LOG_ID] === undefined) {
|
||||||
req[REQUEST_LOG_ID] = ScopedLogger.createScopeId();
|
req[REQUEST_LOG_ID] = ScopedLogger.createScopeId();
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user