mirror of
https://github.com/immich-app/immich
synced 2025-11-07 17:27:20 +00:00
feat(server): correlation id via injected logger (#8823)
* feat(server): correlation id via injected logger * feat: cid response header
This commit is contained in:
parent
95e67a7b1d
commit
2db76034b1
16 changed files with 152 additions and 26 deletions
|
|
@ -2,17 +2,20 @@ import {
|
|||
CallHandler,
|
||||
ExecutionContext,
|
||||
HttpException,
|
||||
Inject,
|
||||
Injectable,
|
||||
InternalServerErrorException,
|
||||
NestInterceptor,
|
||||
} from '@nestjs/common';
|
||||
import { Observable, catchError, throwError } from 'rxjs';
|
||||
import { ImmichLogger } from 'src/utils/logger';
|
||||
import { ILoggerRepository } from 'src/interfaces/logger.interface';
|
||||
import { isConnectionAborted, routeToErrorMessage } from 'src/utils/misc';
|
||||
|
||||
@Injectable()
|
||||
export class ErrorInterceptor implements NestInterceptor {
|
||||
private logger = new ImmichLogger(ErrorInterceptor.name);
|
||||
constructor(@Inject(ILoggerRepository) private logger: ILoggerRepository) {
|
||||
this.logger.setContext(ErrorInterceptor.name);
|
||||
}
|
||||
|
||||
intercept(context: ExecutionContext, next: CallHandler<any>): Observable<any> {
|
||||
return next.handle().pipe(
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue