Files
calendar/apps/api/v2/src/middleware/app.logger.middleware.ts
T
ErikandGitHub 1cfd2f7053 feat: Billing Service (#14756)
* chore: Billing Service

* chore: others

* chore: don't type

* chore: typo

* chore: use proper wh secret

* chore: updates

* chore: lockfile

* chore: docs and comment out

* chore: updates and include plan

* chore: config

* chore: bring back alias

* chore: update lockfile

* chore: refactor

* chore: default none plan in db

* chore: read from env vars

* chore: feedback

* chore: remove json config

* chore: proper type
2024-04-30 20:02:04 +00:00

22 lines
724 B
TypeScript

import { Injectable, NestMiddleware, Logger } from "@nestjs/common";
import { Request, NextFunction } from "express";
import { Response } from "@calcom/platform-types";
@Injectable()
export class AppLoggerMiddleware implements NestMiddleware {
private logger = new Logger("HTTP");
use(request: Request, response: Response, next: NextFunction): void {
const { ip, method, originalUrl } = request;
const userAgent = request.get("user-agent") || "";
response.on("close", () => {
const { statusCode } = response;
const contentLength = response.get("content-length");
this.logger.log(`${method} ${originalUrl} ${statusCode} ${contentLength} - ${userAgent} ${ip}`);
});
next();
}
}