Compare commits

..

No commits in common. "adaedbe5e943bb32f4f9ba1707a9baef70ac074d" and "ef99641f2815731aed2bee34bb576a2e04584174" have entirely different histories.

2 changed files with 4 additions and 3 deletions

View File

@ -1,6 +1,6 @@
{
"name": "nestlogged-fastify",
"version": "3.3.1",
"version": "3.3.0",
"description": "A NestJS Logger Decorator Library With Fastify Support",
"main": "./lib/index.js",
"types": "./lib/index.d.ts",

View File

@ -9,6 +9,7 @@ import {
} from 'nestlogged/lib/logged/utils';
import { objectContainedLogSync, getItemByPathSync } from 'nestlogged/lib/internals/utils';
import { ScopedLogger } from 'nestlogged/lib/logger';
import { kRequestPayloadStream } from 'fastify/lib/symbols';
interface FunctionMetadata {
scopedLoggerInjectableParam?: number;
@ -78,7 +79,7 @@ export function overrideBuild<F extends Array<any>, R>(
'Cannot inject logger: Request type is not http',
);
} else {
let req = ctx.switchToHttp().getRequest()['raw'];
let req = ctx.switchToHttp().getRequest()[kRequestPayloadStream];
if (req[REQUEST_LOG_ID] === undefined) {
req[REQUEST_LOG_ID] = ScopedLogger.createScopeId();
}
@ -100,7 +101,7 @@ export function overrideBuild<F extends Array<any>, R>(
);
} else if (type === 'route') {
// 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) {
req[REQUEST_LOG_ID] = ScopedLogger.createScopeId();
}