feat(logging): add trace ID propagation via AsyncLocalStorage
- add TraceInterceptor that reads x-trace-id header or generates a UUID - add AsyncLocalStorage store in common/trace-context for request-scoped trace ID - replace NestJS Logger with TraceLogger (extends ConsoleLogger) that injects trace ID into log context - register TraceInterceptor globally before LoggingInterceptor - move HealthController into HealthModule so global interceptors apply to /healthz - omit body/response from log lines when empty or null
This commit is contained in:
@@ -2,9 +2,9 @@ import {
|
||||
Injectable,
|
||||
BadRequestException,
|
||||
InternalServerErrorException,
|
||||
Logger,
|
||||
NotFoundException,
|
||||
} from '@nestjs/common';
|
||||
import { TraceLogger } from '../common/trace-logger';
|
||||
import { ConfigService } from '@nestjs/config';
|
||||
import { chromium } from 'playwright';
|
||||
import * as fs from 'fs';
|
||||
@@ -21,7 +21,7 @@ interface KeyDescriptor {
|
||||
|
||||
@Injectable()
|
||||
export class AuthService {
|
||||
private readonly logger = new Logger(AuthService.name);
|
||||
private readonly logger = new TraceLogger(AuthService.name);
|
||||
private readonly keysDir: string;
|
||||
|
||||
constructor(
|
||||
|
||||
Reference in New Issue
Block a user