Skip to content
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

drop express import #2195

Merged
merged 1 commit into from
Jan 23, 2025
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 5 additions & 7 deletions src/LoggerModule.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
/* eslint-disable @typescript-eslint/no-explicit-any */
import { IncomingMessage, ServerResponse } from 'node:http';

import {
Global,
Module,
Expand All @@ -9,7 +11,6 @@ import {
Inject,
} from '@nestjs/common';
import { Provider } from '@nestjs/common/interfaces';
import * as express from 'express';
import { pinoHttp } from 'pino-http';

import { createProvidersForDecorated } from './InjectPinoLogger';
Expand Down Expand Up @@ -127,9 +128,9 @@ function bindLoggerMiddlewareFactory(
assignResponse: boolean,
) {
return function bindLoggerMiddleware(
req: express.Request,
res: express.Response,
next: express.NextFunction,
req: IncomingMessage,
res: ServerResponse,
next: () => void,
) {
let log = req.log;
let resLog = assignResponse ? res.log : undefined;
Expand All @@ -141,9 +142,6 @@ function bindLoggerMiddlewareFactory(
resLog = res.allLogs[res.allLogs.length - 1]!;
}

// eslint-disable-next-line @typescript-eslint/ban-ts-comment
// @ts-ignore: run requires arguments for next but should not because it can
// be called without arguments
storage.run(new Store(log, resLog), next);
};
}
Loading