diff --git a/src/logged.ts b/src/logged.ts index 9774e07..f8f95e2 100644 --- a/src/logged.ts +++ b/src/logged.ts @@ -241,13 +241,20 @@ function overrideBuild, R>( if (req[REQUEST_LOG_ID] === undefined) { req[REQUEST_LOG_ID] = ScopedLogger.createScopeId(); } else { - // TODO: INHERIT SCOPE ID + args[metadatas.scopedLoggerInjectableParam] = ScopedLogger.fromRoot(baseLogger, key, req[REQUEST_LOG_ID]); } } } else if (type === 'middleware') { - // args[0] == Request + let req = args[0]; + if (req[REQUEST_LOG_ID] === undefined) { + req[REQUEST_LOG_ID] = ScopedLogger.createScopeId(); + } else { + args[metadatas.scopedLoggerInjectableParam] = ScopedLogger.fromRoot(baseLogger, key, req[REQUEST_LOG_ID]); + } } else if (type === 'route') { // should use @Req + // WTF how should I get the request id from request object??????????????????????????????????????????????????????????????? + // FUCKFUCKFUCKFUCKFUCKFUCKFUCKFUCKFUCKFUCKFUCKFUCKFUCKFUCKFUCKFUCKFUCKFUCKFUCKFUCKFUCKFUCKFUCKFUCKFUCKFUCKFUCKFUCKFUCKFUCKFUCKFUCKFUCKFUCKFUCKFUCKFUCKFUCKFUCKFUCKFUCKFUCKFUCKFUCKFUCKFUCKFUCKFUCKFUCKFUCKFUCKFUCKFUCKFUCKFUCKFUCKFUCKFUCKFUCKFUCKFUCKFUCKFUCKFUCKFUCKFUCKFUCKFUCKFUCKFUCKFUCKFUCK } } @@ -589,7 +596,7 @@ export function LoggedGuard, R>(options?: Partial, R>(options?: Partial, R>(options?: Partial