temp
This commit is contained in:
parent
c74ad2b119
commit
00fd3e33c4
Binary file not shown.
@ -218,13 +218,31 @@ function overrideBuild<F extends Array<any>, R>(
|
|||||||
// Creating ScopedLogger
|
// Creating ScopedLogger
|
||||||
let injectedLogger: Logger = baseLogger;
|
let injectedLogger: Logger = baseLogger;
|
||||||
if (typeof metadatas.scopedLoggerInjectableParam !== "undefined") {
|
if (typeof metadatas.scopedLoggerInjectableParam !== "undefined") {
|
||||||
if (
|
if (type === 'function') {
|
||||||
args.length <= metadatas.scopedLoggerInjectableParam ||
|
if (
|
||||||
!(args[metadatas.scopedLoggerInjectableParam] instanceof ScopedLogger)
|
args.length <= metadatas.scopedLoggerInjectableParam ||
|
||||||
) {
|
!(args[metadatas.scopedLoggerInjectableParam] instanceof ScopedLogger)
|
||||||
args[metadatas.scopedLoggerInjectableParam] = ScopedLogger.fromRoot(baseLogger, key);
|
) {
|
||||||
|
args[metadatas.scopedLoggerInjectableParam] = ScopedLogger.fromRoot(baseLogger, key);
|
||||||
|
} else {
|
||||||
|
args[metadatas.scopedLoggerInjectableParam] = ScopedLogger.fromSuper(baseLogger, args[metadatas.scopedLoggerInjectableParam], key);
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
args[metadatas.scopedLoggerInjectableParam] = ScopedLogger.fromSuper(baseLogger, args[metadatas.scopedLoggerInjectableParam], key);
|
// special, can access to request object
|
||||||
|
if (type === 'guard' || type === 'interceptor') {
|
||||||
|
// args[0] == ExecutionContext
|
||||||
|
const ctx = (args[0] as ExecutionContext);
|
||||||
|
if (ctx.getType() !== 'http') {
|
||||||
|
injectedLogger.error('Cannot inject logger: Request type is not http');
|
||||||
|
} else {
|
||||||
|
const req = ctx.switchToHttp().getRequest();
|
||||||
|
// TODO HERE
|
||||||
|
}
|
||||||
|
} else if (type === 'middleware') {
|
||||||
|
// args[0] == Request
|
||||||
|
} else if (type === 'route') {
|
||||||
|
// should use @Req
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
injectedLogger = args[metadatas.scopedLoggerInjectableParam];
|
injectedLogger = args[metadatas.scopedLoggerInjectableParam];
|
||||||
|
Loading…
x
Reference in New Issue
Block a user