typeorm logger

This commit is contained in:
hannathkadher
2025-04-22 10:20:48 +04:00
parent be3c9f730d
commit fcb27155d8
8 changed files with 180 additions and 65 deletions

View File

@ -0,0 +1,14 @@
import { Injectable, NestMiddleware } from '@nestjs/common';
import { requestContext } from '../context/request-context';
import { v4 as uuidv4 } from 'uuid';
@Injectable()
export class RequestContextMiddleware implements NestMiddleware {
use(req: any, res: any, next: () => void) {
const context = {
requestId: req.headers['x-request-id'] || uuidv4(),
};
requestContext.run(context, () => next());
}
}