We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
// context.middleware.ts export const ctxSession = cls.createNamespace('my session'); @Injectable() export class RequestContextMiddleware implements NestMiddleware<Request, Response> { use(req: Request, res: Response, next: () => void) { ctxSession.run(() => { ctxSession.set('ctx', { req, res, startTime: new Date() }); next(); }); } } // typeorm-logger.ts export class OrmLogger implements Logger { logQuery(query: string, parameters?: any[], queryRunner?: QueryRunner) { console.log('startTime', ctxSession.get('ctx')?.startTime); // output > startTime 2022-04-13T09:54:21.628Z } logQuerySlow(time: number, query: string, parameters?: any[], queryRunner?: QueryRunner) { console.log('startTime', ctxSession.get('ctx')?.startTime); // output > startTime undefined } }
The text was updated successfully, but these errors were encountered:
// typeorm mysqlQueryRunner.js new Promise(function (ok, fail){ // ... this.driver.connection.logger.logQuery(query, parameters, this); // ... databaseConnection.query(query, parameters, function (err, raw) { // ... _this.driver.connection.logger.logQuerySlow(queryExecutionTime, query, parameters, _this); // ... } }
Sorry, something went wrong.
No branches or pull requests
Why does this problem occur and is there a solution?
The text was updated successfully, but these errors were encountered: