Skip to content

Commit 3b19ede

Browse files
authored
Add logging (calcom#21874)
1 parent 1a0ce47 commit 3b19ede

1 file changed

Lines changed: 5 additions & 0 deletions

File tree

packages/features/bookings/lib/handleNewBooking/checkActiveBookingsLimitForBooker.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,11 @@
11
import { ErrorCode } from "@calcom/lib/errorCodes";
22
import { ErrorWithCode } from "@calcom/lib/errors";
3+
import logger from "@calcom/lib/logger";
34
import prisma from "@calcom/prisma";
45
import { BookingStatus } from "@calcom/prisma/enums";
56

7+
const log = logger.getSubLogger({ prefix: ["[checkActiveBookingsLimitForBooker]"] });
8+
69
export const checkActiveBookingsLimitForBooker = async ({
710
eventTypeId,
811
maxActiveBookingsPerBooker,
@@ -57,6 +60,7 @@ const checkActiveBookingsLimit = async ({
5760
});
5861

5962
if (bookingsCount >= maxActiveBookingsPerBooker) {
63+
log.warn(`Maximum booking limit reached for ${bookerEmail} for event type ${eventTypeId}`);
6064
throw new ErrorWithCode(ErrorCode.BookerLimitExceeded, ErrorCode.BookerLimitExceeded);
6165
}
6266
};
@@ -104,6 +108,7 @@ const checkActiveBookingsLimitAndOfferReschedule = async ({
104108
const lastBooking = bookingsCount[bookingsCount.length - 1];
105109

106110
if (bookingsCount.length >= maxActiveBookingsPerBooker) {
111+
log.warn(`Maximum booking limit reached for ${bookerEmail} for event type ${eventTypeId}`);
107112
throw new ErrorWithCode(
108113
ErrorCode.BookerLimitExceededReschedule,
109114
ErrorCode.BookerLimitExceededReschedule,

0 commit comments

Comments
 (0)