-
Notifications
You must be signed in to change notification settings - Fork 3
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
contextFormat 对 appLogger 不生效 #123
Comments
以下是各种注入方式和行为表现: @Controller('/v1/health')
export class HealthController {
@Logger('customLogger') // 能输出, 能被 format 处理, 不等于 ctx.logger
// @Logger('appLogger') // 能输出, 能被 format 处理, 不等于 ctx.logger
// @Logger() // this.myLogger === undefined
// @Inject() // this.myLogger === undefined
myLogger: ILogger; // 名字不叫 logger
// @Logger('customLogger') // 能输出, 能被 format 处理 (自定义 logger), 不等于 ctx.logger
// @Logger('appLogger') // 能输出, 能被 format 处理, 不等于 ctx.logger
// @Logger() // 能输出, 能被 format 处理, 不等于 ctx.logger
@Inject() // 能输出, 不能被 format 处理, 不能被 contextFormat 拦截, 等于 ctx.logger
logger: ILogger;
@Inject()
ctx: Context;
@Get('/')
async health() {
this.myLogger.info('myLogger');
this.logger.info('logger');
this.ctx.logger.info('ctx.logger');
return true;
}
} |
format 和 contextFormat 是 clients 的两个参数是吧, 请看我上文的测试结果, 均不能被 contextFormat 拦截 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
版本:
@midwayjs/logger: 3.4.0
The text was updated successfully, but these errors were encountered: