Compare commits
2 Commits
ef99641f28
...
adaedbe5e9
Author | SHA1 | Date | |
---|---|---|---|
adaedbe5e9 | |||
7ec88851da |
@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "nestlogged-fastify",
|
"name": "nestlogged-fastify",
|
||||||
"version": "3.3.0",
|
"version": "3.3.1",
|
||||||
"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,7 +9,6 @@ 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;
|
||||||
@ -79,7 +78,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()[kRequestPayloadStream];
|
let req = ctx.switchToHttp().getRequest()['raw'];
|
||||||
if (req[REQUEST_LOG_ID] === undefined) {
|
if (req[REQUEST_LOG_ID] === undefined) {
|
||||||
req[REQUEST_LOG_ID] = ScopedLogger.createScopeId();
|
req[REQUEST_LOG_ID] = ScopedLogger.createScopeId();
|
||||||
}
|
}
|
||||||
@ -101,7 +100,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][kRequestPayloadStream];
|
let req = args[metadatas.scopedLoggerInjectableParam]['raw'];
|
||||||
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