Skip to content
Open
Show file tree
Hide file tree
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
4 changes: 2 additions & 2 deletions apps/api/v1/pages/api/slots/_get.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ describe("GET /api/slots", () => {
});
buildMockData();
await handler(req, res);
console.log({ statusCode: res._getStatusCode(), data: JSON.parse(res._getData()) });
logger.log({ statusCode: res._getStatusCode(), data: JSON.parse(res._getData()) });
const response = JSON.parse(res._getData());
expect(response.slots).toEqual(expect.objectContaining({}));
});
Expand All @@ -83,7 +83,7 @@ describe("GET /api/slots", () => {
});
buildMockData();
await handler(req, res);
console.log({ statusCode: res._getStatusCode(), data: JSON.parse(res._getData()) });
logger.log({ statusCode: res._getStatusCode(), data: JSON.parse(res._getData()) });
const response = JSON.parse(res._getData());
expect(response.slots).toEqual(expect.objectContaining({}));
});
Expand Down
2 changes: 1 addition & 1 deletion apps/api/v1/test/lib/bookings/_get.integration-test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -355,7 +355,7 @@ describe("GET /api/bookings", async () => {
.filter(([_, count]) => count > 1)
.map(([id]) => id);

console.log(`Found duplicate booking IDs: ${duplicates.join(", ")}`);
logger.log(`Found duplicate booking IDs: ${duplicates.join(", ")}`);
}
});
});
Expand Down
6 changes: 3 additions & 3 deletions apps/api/v1/test/lib/bookings/_post.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,7 @@ describe.skipIf(true)("POST /api/bookings", () => {
prismaMock.eventType.findUniqueOrThrow.mockResolvedValue(buildEventType());

await handler(req, res);
console.log({ statusCode: res._getStatusCode(), data: JSON.parse(res._getData()) });
logger.log({ statusCode: res._getStatusCode(), data: JSON.parse(res._getData()) });

expect(res._getStatusCode()).toBe(500);
expect(JSON.parse(res._getData())).toEqual(
Expand Down Expand Up @@ -183,7 +183,7 @@ describe.skipIf(true)("POST /api/bookings", () => {
prismaMock.booking.findMany.mockResolvedValue([]);

await handler(req, res);
console.log({ statusCode: res._getStatusCode(), data: JSON.parse(res._getData()) });
logger.log({ statusCode: res._getStatusCode(), data: JSON.parse(res._getData()) });
createdBooking = JSON.parse(res._getData());
expect(prismaMock.booking.create).toHaveBeenCalledTimes(1);
});
Expand Down Expand Up @@ -212,7 +212,7 @@ describe.skipIf(true)("POST /api/bookings", () => {
prismaMock.booking.findMany.mockResolvedValue([]);

await handler(req, res);
console.log({ statusCode: res._getStatusCode(), data: JSON.parse(res._getData()) });
logger.log({ statusCode: res._getStatusCode(), data: JSON.parse(res._getData()) });
const rescheduledBooking = JSON.parse(res._getData()) as Booking;
expect(prismaMock.booking.create).toHaveBeenCalledTimes(1);
expect(rescheduledBooking.fromReschedule).toEqual(createdBooking.uid);
Expand Down
4 changes: 2 additions & 2 deletions apps/api/v2/scripts/docker-start.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,12 +18,12 @@ try {
// Try docker compose first (new syntax)
try {
execSync("docker compose version", { stdio: "ignore" });
console.log("Starting containers with docker compose...");
logger.log("Starting containers with docker compose...");
execSync("docker compose up -d", { stdio: "inherit" });
} catch (e) {
// Fall back to docker-compose if the above fails
if (checkCommandExists("docker-compose")) {
console.log("Starting containers with docker-compose...");
logger.log("Starting containers with docker-compose...");
execSync("docker-compose up -d", { stdio: "inherit" });
} else {
throw new Error("Neither 'docker compose' nor 'docker-compose' command is available");
Expand Down
4 changes: 2 additions & 2 deletions apps/ui-playground/content/design/components/pagination.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -52,11 +52,11 @@ export const WithCallbacksExample = () => {
const totalItems = 100;

const handleNext = () => {
console.log("Next page clicked");
logger.log("Next page clicked");
};

const handlePrevious = () => {
console.log("Previous page clicked");
logger.log("Previous page clicked");
};

return (
Expand Down
6 changes: 3 additions & 3 deletions apps/web/components/notification-sound-handler.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ export function NotificationSoundHandler() {
const response = await fetch("/ring.mp3");
const arrayBuffer = await response.arrayBuffer();
audioBufferRef.current = await audioContextRef.current.decodeAudioData(arrayBuffer);
console.log("Audio file loaded and decoded");
logger.log("Audio file loaded and decoded");
}

return true;
Expand Down Expand Up @@ -62,7 +62,7 @@ export function NotificationSoundHandler() {

source.loop = true;
source.start(0);
console.log("Sound started playing");
logger.log("Sound started playing");

setTimeout(() => {
if (sourceRef.current === source) {
Expand Down Expand Up @@ -101,7 +101,7 @@ export function NotificationSoundHandler() {

useEffect(() => {
if (!("serviceWorker" in navigator)) {
console.log("ServiceWorker not available");
logger.log("ServiceWorker not available");
return;
}

Expand Down
2 changes: 1 addition & 1 deletion apps/web/cron-tester.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ async function fetchCron(endpoint: string) {
}

try {
console.log("⏳ Running cron endpoints");
logger.log("⏳ Running cron endpoints");
new CronJob(
// Each 5 seconds
"*/5 * * * * *",
Expand Down
2 changes: 1 addition & 1 deletion apps/web/lib/apps/[slug]/getStaticProps.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ export const getStaticProps = async (slug: string) => {
source = source.replace(/{DESCRIPTION}/g, appMeta.description);
} catch (error) {
/* If the app doesn't have a README we fallback to the package description */
console.log(`No DESCRIPTION.md provided for: ${appDirname}`);
logger.log(`No DESCRIPTION.md provided for: ${appDirname}`);
source = appMeta.description;
}

Expand Down
2 changes: 1 addition & 1 deletion apps/web/modules/signup-view.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -216,7 +216,7 @@ export default function Signup({
if (err.checkoutSessionId) {
const stripe = await getStripe();
if (stripe) {
console.log("Redirecting to stripe checkout");
logger.log("Redirecting to stripe checkout");
const { error } = await stripe.redirectToCheckout({
sessionId: err.checkoutSessionId,
});
Expand Down
12 changes: 4 additions & 8 deletions apps/web/playwright/embed-code-generator.e2e.ts
Original file line number Diff line number Diff line change
Expand Up @@ -452,12 +452,10 @@ function assertThatCodeIsValidVanillaJsCode(code: string) {
rules: eslintRules,
});
if (lintResult.length) {
console.log(
JSON.stringify({
logger.log(JSON.stringify({
lintResult,
code,
})
);
}));
}
expect(lintResult.length).toBe(0);
}
Expand All @@ -477,12 +475,10 @@ function assertThatCodeIsValidReactCode(code: string) {
rules: eslintRules,
});
if (lintResult.length) {
console.log(
JSON.stringify({
logger.log(JSON.stringify({
lintResult,
code,
})
);
}));
}
expect(lintResult.length).toBe(0);
}
Expand Down
6 changes: 3 additions & 3 deletions apps/web/playwright/fixtures/embeds.ts
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ export const createEmbedsFixture = (page: Page) => {
console.log("Using api from namespace-", { calNamespace, api });
}
if (!api) {
console.log(`namespace "${calNamespace}" not found yet - Trying again`);
logger.log(`namespace "${calNamespace}" not found yet - Trying again`);
setTimeout(tryAddingListener, 500);
return;
}
Expand All @@ -78,11 +78,11 @@ export const createEmbedsFixture = (page: Page) => {
);

page.on("console", (msg) => {
console.log(`Browser Console: ${msg.type()}: ${msg.text()}`);
logger.log(`Browser Console: ${msg.type()}: ${msg.text()}`);
});

page.on("framenavigated", async (frame) => {
console.log(`Navigation occurred in frame: ${frame.url()}`);
logger.log(`Navigation occurred in frame: ${frame.url()}`);
});

page.on("pageerror", (error) => {
Expand Down
2 changes: 1 addition & 1 deletion apps/web/playwright/integrations.e2e.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ declare let global: {

const requestInterceptor = setupServer(
rest.post("https://api.hubapi.com/oauth/v1/token", (req, res, ctx) => {
console.log(req.body);
logger.log(req.body);
return res(ctx.status(200));
})
);
Expand Down
2 changes: 1 addition & 1 deletion apps/web/playwright/login.2fa.e2e.ts
Original file line number Diff line number Diff line change
Expand Up @@ -169,7 +169,7 @@ async function removeOtpInput(page: Page) {
async function fillOtp({ page, secret, noRetry }: { page: Page; secret: string; noRetry?: boolean }) {
let token = authenticator.generate(secret);
if (!noRetry && !totpAuthenticatorCheck(token, secret)) {
console.log("Token expired, Renerating.");
logger.log("Token expired, Renerating.");
// Maybe token was just about to expire, try again just once more
token = authenticator.generate(secret);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ export async function gotoPathAndExpectRedirectToOrgDomain({
throw new Error("Org slug is not defined");
}
page.goto(path).catch((e) => {
console.log("Expected navigation error to happen");
logger.log("Expected navigation error to happen");
});

const orgSlug = org.slug;
Expand Down
8 changes: 4 additions & 4 deletions apps/web/scripts/check-missing-translations.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ const missingTranslationLocales: string[] = [];
if (locale === TEMPLATE_LANGUAGE) return;
if (!ALL_LOCALES.includes(locale)) {
missingTranslationLocales.push(locale);
console.log(`
logger.log(`
❌ ${locale} is not found in ${LOCALES_PATH}!
If you want to create a new locale, Please create common.json under ${join(LOCALES_PATH, locale)}.
`);
Expand Down Expand Up @@ -44,8 +44,8 @@ const missingTranslationLocales: string[] = [];
});

if (missingTranslationLocales.length) {
console.log("🌍 The following locales need to be translated: ");
console.log(` ${missingTranslationLocales.join(", ")}`);
logger.log("🌍 The following locales need to be translated: ");
logger.log(` ${missingTranslationLocales.join(", ")}`);
} else {
console.log("💯 All the locales are completely translated!");
logger.log("💯 All the locales are completely translated!");
}
16 changes: 8 additions & 8 deletions apps/web/scripts/ts-check-changed-files.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,14 +13,14 @@ const files = diff
.filter(Boolean)
.filter((file) => file.endsWith(".ts") || file.endsWith(".tsx"));

console.log("ℹ️ Changed files:");
console.log(files.map((str) => ` - ${str}`).join("\n"));
logger.log("ℹ️ Changed files:");
logger.log(files.map((str) => ` - ${str}`).join("\n"));

try {
console.log("⏳ Checking type errors..");
logger.log("⏳ Checking type errors..");
execSync("yarn tsc --noEmit", {});

console.log("😻 No errors!");
logger.log("😻 No errors!");
} catch (_err) {
const err = _err as Err;

Expand All @@ -29,12 +29,12 @@ try {
const filesWithTypeErrors = files.filter((file) => output.includes(file));

if (!filesWithTypeErrors.length) {
console.log(`🎉 You haven't introduced any new type errors!`);
logger.log(`🎉 You haven't introduced any new type errors!`);
process.exit(0);
}
console.log("❌ ❌ ❌ You seem to have touched files that have type errors ❌ ❌ ❌");
console.log("🙏 Please inspect the following files:");
console.log(filesWithTypeErrors.map((str) => ` - ${str}`).join("\n"));
logger.log("❌ ❌ ❌ You seem to have touched files that have type errors ❌ ❌ ❌");
logger.log("🙏 Please inspect the following files:");
logger.log(filesWithTypeErrors.map((str) => ` - ${str}`).join("\n"));

process.exit(1);
}
2 changes: 1 addition & 1 deletion apps/web/test/lib/getSchedule/futureLimit.timezone.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -497,7 +497,7 @@ describe("getSchedule", () => {
},
});

console.log({ scheduleForEvent });
logger.log({ scheduleForEvent });

expect(scheduleForEvent).toHaveTimeSlots(
// All slots on current day are available
Expand Down
2 changes: 1 addition & 1 deletion apps/web/test/lib/getSchedule/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,6 @@ export function timeTravelToTheBeginningOfToday({ utcOffsetInHours = 0 }: { utcO
const minutesString = minutes < 10 ? `0${minutes}` : `${minutes}`;

const { dateString: yesterdayDateString } = getDate({ dateIncrement: -1 });
console.log({ yesterdayDateString, hours, minutes });
logger.log({ yesterdayDateString, hours, minutes });
vi.setSystemTime(`${yesterdayDateString}T${hoursString}:${minutesString}:00.000Z`);
}
2 changes: 1 addition & 1 deletion apps/web/test/lib/next-config.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ beforeAll(async () => {
orgUserTypeRouteMatch = match(orgUserTypeRoutePath);

orgUserRouteMatch = match(orgUserRoutePath);
console.log({
logger.log({
regExps: {
orgUserTypeRouteMatch: pathToRegexp(orgUserTypeRoutePath),
orgUserRouteMatch: pathToRegexp(orgUserRoutePath),
Expand Down
2 changes: 1 addition & 1 deletion apps/web/test/lib/plainTiers.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ describe("Plain Integration API", () => {
// Skip all tests if the feature is disabled
if (!IS_PLAIN_CHAT_ENABLED) {
it("skips tests when Plain Chat is disabled", () => {
console.log("Plain Chat is disabled, skipping tests");
logger.log("Plain Chat is disabled, skipping tests");
});
return;
}
Expand Down
2 changes: 1 addition & 1 deletion example-apps/credential-sync/pages/api/getToken.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import { generateGoogleCalendarAccessToken, generateZoomAccessToken } from "../.

export default async function handler(req: NextApiRequest, res: NextApiResponse) {
const secret = req.headers[CALCOM_CREDENTIAL_SYNC_HEADER_NAME];
console.log("getToken hit");
logger.log("getToken hit");
try {
if (!secret) {
return res.status(403).json({ message: "secret header not set" });
Expand Down
8 changes: 4 additions & 4 deletions packages/app-store-cli/src/build.ts
Original file line number Diff line number Diff line change
Expand Up @@ -362,7 +362,7 @@ function generateFiles() {
filesToGenerate.forEach(([fileName, output]) => {
fs.writeFileSync(`${APP_STORE_PATH}/${fileName}`, formatOutput(`${banner}${output.join("\n")}`));
});
console.log(`Generated ${filesToGenerate.map(([fileName]) => fileName).join(", ")}`);
logger.log(`Generated ${filesToGenerate.map(([fileName]) => fileName).join(", ")}`);
}

const debouncedGenerateFiles = debounce(generateFiles);
Expand All @@ -373,20 +373,20 @@ if (isInWatchMode) {
.on("addDir", (dirPath) => {
const appName = getAppName(dirPath);
if (appName) {
console.log(`Added ${appName}`);
logger.log(`Added ${appName}`);
debouncedGenerateFiles();
}
})
.on("change", (filePath) => {
if (filePath.endsWith("config.json")) {
console.log("Config file changed");
logger.log("Config file changed");
debouncedGenerateFiles();
}
})
.on("unlinkDir", (dirPath) => {
const appName = getAppName(dirPath);
if (appName) {
console.log(`Removed ${appName}`);
logger.log(`Removed ${appName}`);
debouncedGenerateFiles();
}
});
Expand Down
2 changes: 1 addition & 1 deletion packages/app-store-cli/src/cli.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ if (
) {
slug = cli.flags.slug;
if (!slug) {
console.log("--slug is required");
logger.log("--slug is required");
cli.showHelp(0);
}
}
Expand Down
8 changes: 4 additions & 4 deletions packages/app-store-cli/src/utils/execSync.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,23 +3,23 @@ import child_process from "child_process";
const execSync = async (cmd: string) => {
const silent = process.env.DEBUG === "1" ? false : true;
if (!silent) {
console.log(`${process.cwd()}$: ${cmd}`);
logger.log(`${process.cwd()}$: ${cmd}`);
}
const result: string = await new Promise((resolve, reject) => {
child_process.exec(cmd, (err, stdout, stderr) => {
if (err) {
reject(err);
console.log(err);
logger.log(err);
}
if (stderr && !silent) {
console.log(stderr);
logger.log(stderr);
}
resolve(stdout);
});
});

if (!silent) {
console.log(result.toString());
logger.log(result.toString());
}
return cmd;
};
Expand Down
Loading