Skip to content

Rallly is an open-source scheduling and collaboration tool designed to make organizing events and meetings easier.

πŸ§‘β€πŸ’» Add logger package (#2143)

Luke Vellaa1c36c49f58d
diff --git a/apps/web/package.json b/apps/web/package.json
index ae5ab1fa3..d5d9df1fa 100644
--- a/apps/web/package.json
+++ b/apps/web/package.json
@@ -40,6 +40,7 @@
"@rallly/database": "workspace:*",
"@rallly/emails": "workspace:*",
"@rallly/languages": "workspace:*",
+ "@rallly/logger": "workspace:*",
"@rallly/posthog": "workspace:*",
"@rallly/tailwind-config": "workspace:*",
"@rallly/ui": "workspace:*",
diff --git a/apps/web/src/app/api/auth/invalid-session/route.ts b/apps/web/src/app/api/auth/invalid-session/route.ts
index af2c1e157..215065b8f 100644
--- a/apps/web/src/app/api/auth/invalid-session/route.ts
+++ b/apps/web/src/app/api/auth/invalid-session/route.ts
@@ -1,8 +1,11 @@
+import { createLogger } from "@rallly/logger";
import type { NextRequest } from "next/server";
import { NextResponse } from "next/server";
import auth from "@/lib/auth";
import { signOut as legacySignOut } from "@/next-auth";
+const logger = createLogger("api/auth/invalid-session");
+
export async function GET(req: NextRequest) {
try {
await Promise.all([
@@ -14,7 +17,7 @@ export async function GET(req: NextRequest) {
}),
]);
} catch (error) {
- console.error("FAILED TO SIGN OUT", error);
+ logger.error({ error }, "Failed to sign out");
}
return NextResponse.redirect(new URL("/login", req.url));
diff --git a/apps/web/src/app/api/licensing/v1/[...route]/route.ts b/apps/web/src/app/api/licensing/v1/[...route]/route.ts
index 49e2483ca..f85b2f800 100644
--- a/apps/web/src/app/api/licensing/v1/[...route]/route.ts
+++ b/apps/web/src/app/api/licensing/v1/[...route]/route.ts
@@ -1,12 +1,16 @@
import { zValidator } from "@hono/zod-validator";
import { RedisStore } from "@hono-rate-limiter/redis";
import { prisma } from "@rallly/database";
+import { createLogger } from "@rallly/logger";
import { kv } from "@vercel/kv";
import { Hono } from "hono";
import { bearerAuth } from "hono/bearer-auth";
import { handle } from "hono/vercel";
import { rateLimiter } from "hono-rate-limiter";
import { env } from "@/env";
+
+const logger = createLogger("api/licensing");
+
import { generateLicenseKey } from "@/features/licensing/helpers/generate-license-key";
import type {
CreateLicenseResponse,
@@ -65,7 +69,7 @@ if (env.LICENSE_API_AUTH_TOKEN) {
data: { key: license.licenseKey },
} satisfies CreateLicenseResponse);
} catch (error) {
- console.error("Failed to create license:", error);
+ logger.error({ error }, "Failed to create license");
return c.json({ error: "Failed to create license" }, 500);
}
},
diff --git a/apps/web/src/app/api/storage/[...key]/route.ts b/apps/web/src/app/api/storage/[...key]/route.ts
index 7b072f6d9..2363c3f7c 100644
--- a/apps/web/src/app/api/storage/[...key]/route.ts
+++ b/apps/web/src/app/api/storage/[...key]/route.ts
@@ -1,10 +1,13 @@
import { GetObjectCommand } from "@aws-sdk/client-s3";
+import { createLogger } from "@rallly/logger";
import type { NextRequest } from "next/server";
import { NextResponse } from "next/server";
import { env } from "@/env";
import { getS3Client } from "@/lib/storage/s3";
+const logger = createLogger("api/storage");
+
async function getAvatar(key: string) {
const s3Client = getS3Client();
@@ -51,7 +54,7 @@ export async function GET(
},
});
} catch (error) {
- console.error(error);
+ logger.error({ error, imageKey }, "Failed to fetch object from storage");
return NextResponse.json(
{ error: "Failed to fetch object" },
{ status: 500 },
diff --git a/apps/web/src/app/api/stripe/buy-license/route.ts b/apps/web/src/app/api/stripe/buy-license/route.ts
index 0c8460ac3..05b7dd743 100644
--- a/apps/web/src/app/api/stripe/buy-license/route.ts
+++ b/apps/web/src/app/api/stripe/buy-license/route.ts
@@ -1,10 +1,13 @@
import { stripe } from "@rallly/billing";
import type { LicenseType } from "@rallly/database";
+import { createLogger } from "@rallly/logger";
import type { NextRequest } from "next/server";
import { NextResponse } from "next/server";
import { z } from "zod";
import type { LicenseCheckoutMetadata } from "@/features/licensing/schema";
+const logger = createLogger("api/stripe/buy-license");
+
const productSchema = z.enum(["plus", "organization"]);
type Product = z.infer<typeof productSchema>;
@@ -33,24 +36,23 @@ export async function GET(request: NextRequest) {
});
if (!prices.data || prices.data.length === 0) {
- // Log this error on your server, as it might indicate a misconfiguration
- console.error(`No price found for lookup_key: ${product}`);
+ logger.error({ product }, "No price found for lookup_key");
return NextResponse.json(
{ error: "Pricing information not found for this product." },
{ status: 500 },
); // Or 404 if you prefer
}
if (prices.data.length > 1) {
- // This might indicate a configuration issue (e.g., duplicate lookup keys)
- console.warn(
- `Multiple prices found for lookup_key: ${product}. Using the first one.`,
+ logger.warn(
+ { product },
+ "Multiple prices found for lookup_key, using the first one",
);
}
const price = prices.data[0];
if (!price.id) {
- console.error(`Price object for ${product} is missing an ID.`);
+ logger.error({ product }, "Price object is missing an ID");
return NextResponse.json(
{ error: "Price configuration error." },
{ status: 500 },
@@ -92,7 +94,7 @@ export async function GET(request: NextRequest) {
{ status: 500 },
);
} catch (error) {
- console.error("Stripe API error:", error);
+ logger.error({ error }, "Stripe API error");
let errorMessage =
"An unexpected error occurred with our payment processor.";
diff --git a/apps/web/src/app/api/trpc/[trpc]/route.ts b/apps/web/src/app/api/trpc/[trpc]/route.ts
index 6f6439f51..f8983e0f3 100644
--- a/apps/web/src/app/api/trpc/[trpc]/route.ts
+++ b/apps/web/src/app/api/trpc/[trpc]/route.ts
@@ -1,9 +1,13 @@
import { getPreferredLocale } from "@rallly/languages/get-preferred-locale";
+import { createLogger } from "@rallly/logger";
import { fetchRequestHandler } from "@trpc/server/adapters/fetch";
import { ipAddress } from "@vercel/functions";
import type { NextRequest } from "next/server";
import { getSession } from "@/lib/auth";
+
+const logger = createLogger("api/trpc");
+
import { getLocaleFromRequest } from "@/lib/locale/server";
import type { TRPCContext } from "@/trpc/context";
import { appRouter } from "@/trpc/routers";
@@ -48,12 +52,15 @@ const handler = async (req: NextRequest) => {
},
onError({ error }) {
if (error.code === "TOO_MANY_REQUESTS") {
- console.warn("Too many requests", {
- path: req.nextUrl.pathname,
- userId: session?.user?.id,
- ip,
- ja4Digest,
- });
+ logger.warn(
+ {
+ path: req.nextUrl.pathname,
+ userId: session?.user?.id,
+ ip,
+ ja4Digest,
+ },
+ "Too many requests",
+ );
}
},
});
diff --git a/apps/web/src/auth/helpers/merge-user.ts b/apps/web/src/auth/helpers/merge-user.ts
index 66bc485bf..27f6f4cd5 100644
--- a/apps/web/src/auth/helpers/merge-user.ts
+++ b/apps/web/src/auth/helpers/merge-user.ts
@@ -1,8 +1,11 @@
import { prisma } from "@rallly/database";
+import { createLogger } from "@rallly/logger";
import * as Sentry from "@sentry/nextjs";
import { waitUntil } from "@vercel/functions";
import { PostHogClient } from "@/features/analytics/posthog";
+const logger = createLogger("auth/merge-user");
+
const getActiveSpaceForUser = async ({ userId }: { userId: string }) => {
const spaceMember = await prisma.spaceMember.findFirst({
where: {
@@ -81,7 +84,7 @@ export const linkAnonymousUser = async (
const spaceId = await getActiveSpaceForUser({ userId: authenticatedUserId });
if (!spaceId) {
- console.error(`User ${authenticatedUserId} has no active space`);
+ logger.error({ userId: authenticatedUserId }, "User has no active space");
return;
}
diff --git a/apps/web/src/features/licensing/actions.ts b/apps/web/src/features/licensing/actions.ts
index 0a5bd7ed3..d2e94aa11 100644
--- a/apps/web/src/features/licensing/actions.ts
+++ b/apps/web/src/features/licensing/actions.ts
@@ -1,6 +1,7 @@
"use server";
import { prisma } from "@rallly/database";
+import { createLogger } from "@rallly/logger";
import { revalidateTag } from "next/cache";
import { INSTANCE_LICENSE_TAG } from "@/features/licensing/constants";
import { validateLicenseKeyInputSchema } from "@/features/licensing/schema";
@@ -8,6 +9,8 @@ import { AppError } from "@/lib/errors";
import { adminActionClient } from "@/lib/safe-action/server";
import { licenseManager } from "./server";
+const logger = createLogger("licensing/actions");
+
export const removeInstanceLicenseAction = adminActionClient
.metadata({
actionName: "remove_instance_license",
@@ -80,8 +83,8 @@ export const refreshInstanceLicenseAction = adminActionClient
success: true,
message: "License refreshed successfully",
};
- } catch (_error) {
- console.error(_error);
+ } catch (error) {
+ logger.error({ error }, "Failed to refresh license");
throw new AppError({
code: "INTERNAL_SERVER_ERROR",
message: "Failed to validate license",
diff --git a/apps/web/src/features/licensing/lib/licensing-manager.ts b/apps/web/src/features/licensing/lib/licensing-manager.ts
index 4cd011e3e..7dc6865d1 100644
--- a/apps/web/src/features/licensing/lib/licensing-manager.ts
+++ b/apps/web/src/features/licensing/lib/licensing-manager.ts
@@ -1,3 +1,4 @@
+import { createLogger } from "@rallly/logger";
import { AppError } from "@/lib/errors";
import type {
CreateLicenseInput,
@@ -8,6 +9,8 @@ import {
validateLicenseKeyResponseSchema,
} from "../schema";
+const logger = createLogger("licensing/manager");
+
export class LicenseManager {
apiUrl: string;
authToken?: string;
@@ -53,7 +56,7 @@ export class LicenseManager {
const data = await res.json();
if (!res.ok) {
- console.error(data);
+ logger.error({ data }, "License validation failed");
throw new AppError({
code: "INTERNAL_SERVER_ERROR",
cause: data,
diff --git a/apps/web/src/features/moderation/index.ts b/apps/web/src/features/moderation/index.ts
index 8e665788b..8524a4dd6 100644
--- a/apps/web/src/features/moderation/index.ts
+++ b/apps/web/src/features/moderation/index.ts
@@ -1,8 +1,11 @@
+import { createLogger } from "@rallly/logger";
import { env } from "@/env";
import { moderateContentWithAI } from "./libs/ai-moderation";
import { containsSuspiciousPatterns } from "./libs/pattern-moderation";
+const logger = createLogger("moderation");
+
/**
* Moderates content to detect spam, inappropriate content, or abuse
* Uses a two-layer approach:
@@ -20,7 +23,7 @@ export async function moderateContent(content: Array<string | undefined>) {
// Check if OpenAI API key is available
if (!env.OPENAI_API_KEY) {
- console.warn(
+ logger.warn(
"Content moderation is enabled but OPENAI_API_KEY is not set. AI-based moderation will be skipped.",
);
return false;
@@ -33,17 +36,15 @@ export async function moderateContent(content: Array<string | undefined>) {
// If suspicious patterns are found, perform AI moderation
if (hasSuspiciousPatterns) {
- console.info(
- "⚠️ Suspicious patterns detected, performing AI moderation check",
- );
+ logger.info("Suspicious patterns detected, performing AI moderation check");
try {
const isFlagged = await moderateContentWithAI(textToModerate);
if (isFlagged) {
- console.warn("🚫 Content flagged by AI moderation");
+ logger.warn("Content flagged by AI moderation");
}
return isFlagged;
} catch (error) {
- console.error("Error during AI content moderation:", error);
+ logger.error({ error }, "Error during AI content moderation");
return false;
}
}
diff --git a/apps/web/src/features/moderation/libs/ai-moderation.ts b/apps/web/src/features/moderation/libs/ai-moderation.ts
index 7ffcebaa9..0a0d327c3 100644
--- a/apps/web/src/features/moderation/libs/ai-moderation.ts
+++ b/apps/web/src/features/moderation/libs/ai-moderation.ts
@@ -1,6 +1,9 @@
import { openai } from "@ai-sdk/openai";
+import { createLogger } from "@rallly/logger";
import { generateText } from "ai";
+const logger = createLogger("moderation/ai");
+
/**
* Moderates content using OpenAI's GPT-4 to detect inappropriate content
* @param text The text to moderate
@@ -22,7 +25,7 @@ export async function moderateContentWithAI(text: string) {
return result.text.includes("FLAGGED");
} catch (err) {
- console.error("❌ AI moderation failed:", err);
+ logger.error({ error: err }, "AI moderation failed");
return false;
}
}
diff --git a/apps/web/src/features/space/actions.ts b/apps/web/src/features/space/actions.ts
index d83ccbf6b..bff9c8e51 100644
--- a/apps/web/src/features/space/actions.ts
+++ b/apps/web/src/features/space/actions.ts
@@ -3,10 +3,14 @@
import { subject } from "@casl/ability";
import { accessibleBy } from "@casl/prisma";
import { prisma } from "@rallly/database";
+import { createLogger } from "@rallly/logger";
import { absoluteUrl } from "@rallly/utils/absolute-url";
import { waitUntil } from "@vercel/functions";
import { revalidatePath } from "next/cache";
import { z } from "zod";
+
+const logger = createLogger("space/actions");
+
import { getMember, getSpaceSeatCount } from "@/features/space/data";
import { createSpace } from "@/features/space/mutations";
import { memberRoleSchema } from "@/features/space/schema";
@@ -324,8 +328,8 @@ export const inviteMemberAction = spaceActionClient
code: "INVITE_SENT" as const,
message: "Invitation sent successfully",
};
- } catch {
- console.error("Failed to send invitation");
+ } catch (error) {
+ logger.error({ error }, "Failed to send invitation");
return {
success: false,
code: "INVITE_FAILED" as const,
@@ -397,8 +401,8 @@ export const acceptInviteAction = authActionClient
userId: ctx.user.id,
spaceId: parsedInput.spaceId,
});
- } catch {
- console.warn("Failed to update user's active space");
+ } catch (error) {
+ logger.warn({ error }, "Failed to update user's active space");
}
ctx.posthog?.capture({
diff --git a/apps/web/src/features/space/data.ts b/apps/web/src/features/space/data.ts
index edb68866e..99a9422d9 100644
--- a/apps/web/src/features/space/data.ts
+++ b/apps/web/src/features/space/data.ts
@@ -4,8 +4,12 @@ import type {
SpaceTier as DBSpaceTier,
} from "@rallly/database";
import { prisma } from "@rallly/database";
+import { createLogger } from "@rallly/logger";
import { cache } from "react";
import { requireSpace, requireUser } from "@/auth/data";
+
+const logger = createLogger("space/data");
+
import type { MemberDTO } from "@/features/space/member/types";
import type { SpaceDTO } from "@/features/space/types";
import { fromDBRole } from "@/features/space/utils";
@@ -91,8 +95,9 @@ export const loadSpaces = cache(async () => {
const role = space.members[0]?.role;
if (!role) {
- console.warn(
- `User ${user.id} does not have access to space ${space.id}`,
+ logger.warn(
+ { userId: user.id, spaceId: space.id },
+ "User does not have access to space",
);
return null;
}
diff --git a/apps/web/src/features/space/utils.ts b/apps/web/src/features/space/utils.ts
index 671247c80..7cbf6b78a 100644
--- a/apps/web/src/features/space/utils.ts
+++ b/apps/web/src/features/space/utils.ts
@@ -1,4 +1,5 @@
import type { SpaceMemberRole as PrismaSpaceMemberRole } from "@rallly/database";
+import { createLogger } from "@rallly/logger";
import { getSpaceSubscription } from "@/features/billing/data";
import { cached_getInstanceLicense } from "@/features/licensing/data";
import type { LicenseType } from "@/features/licensing/schema";
@@ -6,6 +7,8 @@ import type { MemberRole } from "@/features/space/schema";
import { AppError } from "@/lib/errors";
import { isSelfHosted } from "@/utils/constants";
+const logger = createLogger("space/utils");
+
export const toDBRole = (role: MemberRole): PrismaSpaceMemberRole => {
switch (role) {
case "member":
@@ -86,8 +89,7 @@ export async function getTotalSeatsForSpace(spaceId: string): Promise<number> {
return subscription.quantity || DEFAULT_SEAT_LIMIT;
}
} catch (error) {
- // Log the error for debugging but don't expose internal details
- console.error(`Failed to get total seats for space ${spaceId}:`, error);
+ logger.error({ error, spaceId }, "Failed to get total seats for space");
if (error instanceof AppError) {
throw error;
diff --git a/apps/web/src/lib/auth.ts b/apps/web/src/lib/auth.ts
index 78466a9a4..ae8dce0d7 100644
--- a/apps/web/src/lib/auth.ts
+++ b/apps/web/src/lib/auth.ts
@@ -1,4 +1,5 @@
import { prisma } from "@rallly/database";
+import { createLogger } from "@rallly/logger";
import { absoluteUrl } from "@rallly/utils/absolute-url";
import { waitUntil } from "@vercel/functions";
import type { BetterAuthPlugin } from "better-auth";
@@ -32,11 +33,13 @@ import { getValueByPath } from "@/utils/get-value-by-path";
const baseURL = absoluteUrl("/api/better-auth");
+const logger = createLogger("auth");
+
const plugins: BetterAuthPlugin[] = [];
if (env.OIDC_CLIENT_ID && env.OIDC_CLIENT_SECRET && env.OIDC_DISCOVERY_URL) {
if (env.OIDC_ISSUER_URL) {
- console.info(
+ logger.info(
"OIDC_ISSUER_URL is no longer used. You can remove it from your environment variables.",
);
}
@@ -369,7 +372,7 @@ export const getSession = cache(async () => {
};
}
} catch (e) {
- console.error("FAILED TO GET SESSION", e);
+ logger.error({ error: e }, "Failed to get session");
return null;
}
@@ -384,7 +387,7 @@ export const getSession = cache(async () => {
};
}
} catch (e) {
- console.error("FAILED TO GET LEGACY SESSION", e);
+ logger.error({ error: e }, "Failed to get legacy session");
return null;
}
diff --git a/apps/web/src/lib/oauth/server.ts b/apps/web/src/lib/oauth/server.ts
index 79ee1b8b4..b7072a339 100644
--- a/apps/web/src/lib/oauth/server.ts
+++ b/apps/web/src/lib/oauth/server.ts
@@ -1,6 +1,7 @@
import "server-only";
import { zValidator } from "@hono/zod-validator";
+import { createLogger } from "@rallly/logger";
import { generateCodeVerifier, generateState } from "arctic";
import { Hono } from "hono";
import { getCookie, setCookie } from "hono/cookie";
@@ -9,6 +10,8 @@ import { z } from "zod";
import { validateRedirectUrl } from "@/utils/redirect";
import type { CreateOAuthOptions } from "./types";
+const logger = createLogger("oauth");
+
export function OAuthIntegration<T extends string>(
options: CreateOAuthOptions<T>,
) {
@@ -90,7 +93,7 @@ export function OAuthIntegration<T extends string>(
return c.redirect(authorizationUrl.toString());
} catch (error) {
- console.error("OAuth auth initiation failed:", error);
+ logger.error({ error }, "OAuth auth initiation failed");
return c.json({ error: "Failed to initiate OAuth connection" }, 404);
}
@@ -152,7 +155,7 @@ export function OAuthIntegration<T extends string>(
return c.redirect(successUrl.toString());
} catch (error) {
- console.error("OAuth connection failed:", error);
+ logger.error({ error }, "OAuth connection failed");
const redirectTo = getCookie(c, REDIRECT_TO) || "/";
const errorUrl = new URL(redirectTo, c.req.url);
diff --git a/apps/web/src/lib/rate-limit/index.ts b/apps/web/src/lib/rate-limit/index.ts
index 2dd8b7546..e100d99fa 100644
--- a/apps/web/src/lib/rate-limit/index.ts
+++ b/apps/web/src/lib/rate-limit/index.ts
@@ -1,5 +1,6 @@
import "server-only";
+import { createLogger } from "@rallly/logger";
import { Ratelimit } from "@upstash/ratelimit";
import { kv } from "@vercel/kv";
import { headers } from "next/headers";
@@ -8,6 +9,8 @@ import { getSession } from "@/lib/auth";
import { isRateLimitEnabled } from "./constants";
+const logger = createLogger("rate-limit");
+
export type Unit = "ms" | "s" | "m" | "h" | "d";
export type Duration = `${number} ${Unit}` | `${number}${Unit}`;
@@ -36,7 +39,7 @@ export async function rateLimit(
return ratelimit.limit(`${identifier}:${name}`);
} catch (e) {
- console.error(e);
+ logger.error({ error: e, name }, "Rate limit error");
return {
success: true,
};
diff --git a/apps/web/src/utils/date-time-utils.ts b/apps/web/src/utils/date-time-utils.ts
index 84c2a6dc4..42a1e224b 100644
--- a/apps/web/src/utils/date-time-utils.ts
+++ b/apps/web/src/utils/date-time-utils.ts
@@ -27,7 +27,7 @@ function getTimeZoneOffset(timeZone: string) {
try {
return dayjs().tz(timeZone).utcOffset();
} catch {
- console.error(`Failed to resolve timezone ${timeZone}`);
+ console.error({ timeZone }, "Failed to resolve timezone");
return 0;
}
}
@@ -77,7 +77,7 @@ export function normalizeTimeZone(timeZone: string) {
if (!tz) {
// In theory this shouldn't happen
tz = "America/New_York";
- console.error(`Unable to resolve timezone ${timeZone}`);
+ console.error({ timeZone }, "Unable to resolve timezone");
}
return tz;
diff --git a/apps/web/src/utils/emails.ts b/apps/web/src/utils/emails.ts
index d37517b7c..6eea12896 100644
--- a/apps/web/src/utils/emails.ts
+++ b/apps/web/src/utils/emails.ts
@@ -1,11 +1,14 @@
import type { SupportedEmailProviders } from "@rallly/emails";
import { EmailClient } from "@rallly/emails";
+import { createLogger } from "@rallly/logger";
import { absoluteUrl } from "@rallly/utils/absolute-url";
import * as Sentry from "@sentry/nextjs";
import { env } from "@/env";
import { getInstanceBrandingConfig } from "@/features/branding/queries";
+const logger = createLogger("emails");
+
export const getEmailClient = async (locale?: string) => {
const brandingConfig = await getInstanceBrandingConfig();
@@ -30,7 +33,7 @@ export const getEmailClient = async (locale?: string) => {
},
locale,
onError: (e) => {
- console.error(e);
+ logger.error({ error: e }, "Email client error");
Sentry.captureException(e);
},
});
diff --git a/packages/logger/package.json b/packages/logger/package.json
new file mode 100644
index 000000000..d4e4c510c
--- /dev/null
+++ b/packages/logger/package.json
@@ -0,0 +1,15 @@
+{
+ "name": "@rallly/logger",
+ "version": "0.0.0",
+ "private": true,
+ "exports": {
+ ".": "./src/index.ts"
+ },
+ "dependencies": {
+ "pino": "^10.2.0",
+ "pino-pretty": "^13.1.3"
+ },
+ "devDependencies": {
+ "@rallly/tsconfig": "workspace:*"
+ }
+}
diff --git a/packages/logger/src/index.ts b/packages/logger/src/index.ts
new file mode 100644
index 000000000..019a11ac2
--- /dev/null
+++ b/packages/logger/src/index.ts
@@ -0,0 +1,24 @@
+import pino from "pino";
+import pinoPretty from "pino-pretty";
+
+const level = process.env.LOG_LEVEL ?? "info";
+const isDevelopment = process.env.NODE_ENV === "development";
+
+const stream = isDevelopment
+ ? pinoPretty({
+ colorize: true,
+ })
+ : undefined;
+
+export const logger = pino(
+ {
+ level,
+ },
+ stream,
+);
+
+export type Logger = typeof logger;
+
+export function createLogger(name: string) {
+ return logger.child({ name });
+}
diff --git a/packages/logger/tsconfig.json b/packages/logger/tsconfig.json
new file mode 100644
index 000000000..2052b73be
--- /dev/null
+++ b/packages/logger/tsconfig.json
@@ -0,0 +1,7 @@
+{
+ "extends": "@rallly/tsconfig/node.json",
+ "compilerOptions": {
+ "outDir": "dist"
+ },
+ "include": ["src"]
+}
diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml
index 52b74c9f5..80ad7f2e1 100644
--- a/pnpm-lock.yaml
+++ b/pnpm-lock.yaml
@@ -244,6 +244,9 @@ importers:
'@rallly/languages':
specifier: workspace:*
version: link:../../packages/languages
+ '@rallly/logger':
+ specifier: workspace:*
+ version: link:../../packages/logger
'@rallly/posthog':
specifier: workspace:*
version: link:../../packages/posthog
@@ -654,6 +657,19 @@ importers:
specifier: ^0.6.3
version: 0.6.3
+ packages/logger:
+ dependencies:
+ pino:
+ specifier: ^10.2.0
+ version: 10.2.1
+ pino-pretty:
+ specifier: ^13.1.3
+ version: 13.1.3
+ devDependencies:
+ '@rallly/tsconfig':
+ specifier: workspace:*
+ version: link:../tsconfig
+
packages/posthog:
dependencies:
js-cookie:
@@ -3158,6 +3174,9 @@ packages:
resolution: {integrity: sha512-BRs5XUAwiyCDQMsVA9IDvDa7UBR9gAvPHgugOeGng3YN6vJ9JYonyDc0lNczErgtCWtucjR5N7VtaonboD/ezg==}
engines: {node: '>=10.12.0'}
+ '@pinojs/[email protected]':
+ resolution: {integrity: sha512-k2ENnmBugE/rzQfEcdWHcCY+/FM3VLzH9cYEsbdsoqrvzAKRhUZeRNhAZvB8OitQJ1TBed3yqWtdjzS6wJKBwg==}
+
resolution: {integrity: sha512-+1VkjdD0QBLPodGrJUeqarH8VAIvQODIbwh9XpP5Syisf7YoQgsJKPNFoqqLQlu+VQ/tVSshMR6loPMn8U+dPg==}
engines: {node: '>=14'}
@@ -5600,6 +5619,10 @@ packages:
resolution: {integrity: sha512-Oei9OH4tRh0YqU3GxhX79dM/mwVgvbZJaSNaRk+bshkj0S5cfHcgYakreBjrHwatXKbz+IoIdYLxrKim2MjW0Q==}
+ resolution: {integrity: sha512-kNOjDqAh7px0XWNI+4QbzoiR/nTkHAWNud2uvnJquD1/x5a7EQZMJT0AczqK0Qn67oY/TTQ1LbUKajZpp3I9tQ==}
+ engines: {node: '>=8.0.0'}
+
resolution: {integrity: sha512-+gDffFXRW6sl/HCwbta7zK4uNqbPjv4YJEAdz7Vu+FLQHe77eZ4bvbJGi4hE0QPeJlMYMA3piXEr1UL3dAwx7Q==}
@@ -6040,6 +6063,9 @@ packages:
resolution: {integrity: sha512-1rXeuUUiGGrykh+CeBdu5Ie7OJwinCgQY0bc7GCRxy5xVHy+moaqkpL/jqQq0MtQOeYcrqEz4abc5f0KtU7W4A==}
engines: {node: '>=12.5.0'}
+ resolution: {integrity: sha512-IfEDxwoWIjkeXL1eXcDiow4UbKjhLdq6/EuSVR9GMN7KVH3r9gQ83e73hsz1Nd1T3ijd5xv1wcWRYO+D6kCI2w==}
+
resolution: {integrity: sha512-FQN4MRfuJeHf7cBbBMJFXhKSDq+2kAArBlmRBvcvFE5BB1HZKXtSFASDhdlz9zOYwxh8lDdnvmMOe/+5cdoEdg==}
engines: {node: '>= 0.8'}
@@ -6243,6 +6269,9 @@ packages:
resolution: {integrity: sha512-QWxYLR5P/6GStZcdem+V1xoto6DMadYWpMXU82ES3/RfR3Wdwr3D0+be7mgOJ+Ov0G9D5Dmb9T17sNLQYj9XOg==}
+ resolution: {integrity: sha512-2P0p0pFGzHS5EMnhdxQi7aJN+iMheud0UhG4dlE1DLAlvL8JHjJJTX/CSm4JXwV0Ka5nGk3zC5mcb5bUQUxxMA==}
+
resolution: {integrity: sha512-oaMBel6gjolK862uaPQOVTA7q3TZhuSvuMQAAglQDOWYO9A91IrAOUJEyKVlqJlHE0vq5p5UXxzdPfMH/x6xNg==}
@@ -6714,6 +6743,9 @@ packages:
resolution: {integrity: sha512-h5+1OzzfCC3Ef7VbtKdcv7zsstUQwUDlYpUTvjeUsJAssPgLn7QzbboPtL5ro04Mq0rPOsMzl7q5hIbRs2wD1A==}
engines: {node: '>=8.0.0'}
+ resolution: {integrity: sha512-ybA6PDXIXOXivLJK/z9e+Otk7ve13I4ckBvGO5I2RRmBU1gMHLVDJYEuJYhGwez7YNlYji2M2DvVU+a9mSFDlw==}
+
resolution: {integrity: sha512-bCK/2Z4zLidyB4ReuIsvALH6w31YfAQDmXMqMx6FyfHqvBxtjC0eRumeSu4Bs3XtXwpyIywtSTrVT99BxY1f9w==}
@@ -6730,6 +6762,9 @@ packages:
resolution: {integrity: sha512-Ue0LwpDYErFbmNnZSF0UH6eImUwDmogUO1jyE+JbN2gsQz/jICm1Ve7t9QT0rNSsfJt+Hs4/S3GnsDVjL4HVrw==}
+ resolution: {integrity: sha512-W+KJc2dmILlPplD/H4K9l9LcAHAfPtP6BY84uVLXQ6Evcz9Lcg33Y2z1IVblT6xdY54PXYVHEv+0Wpq8Io6zkA==}
+
resolution: {integrity: sha512-HPtaa38cPgWvaCFmRNhlc6NG7pv6NUHqjPgVAkWGoB9mQMwYB27/K0CvOM5Czy+qpT3e8XJ6Q4aPAnzpNpzNaw==}
@@ -7139,6 +7174,9 @@ packages:
resolution: {integrity: sha512-g7df9rMFX/SPi34tyGCyUBREQoKkapwdY/T04Qn9TDWfHhAYt4/I0gMVirzK5wEzeUqIjEB+LXC/ypb7Aqno5w==}
+ resolution: {integrity: sha512-7xgomUX6ADmcYzFik0HzAxh/73YlKR9bmFzf51CZwR+b6YtzU2m0u49hQCqV6SvlqIqsaxovfwdvbnsw3b/zpg==}
+
resolution: {integrity: sha512-NQO+lgVUCtHxZ792FodgW0zflK+ozS9X9dwGp9XvvmPlH7pyxd588cn24TD3rmPm/N0AIRXF10Otah8yKqGw4w==}
engines: {node: '>=12'}
@@ -7617,6 +7655,10 @@ packages:
resolution: {integrity: sha512-TTQJyoEoKcC1lscpVDCSsVgYzUDg/0Bt3WE//WiTPK6uOCQC2KZS4MpugbMWt/zyjkopgZoXhZuCi00gLudfUA==}
+ resolution: {integrity: sha512-34wB/Y7MW7bzjKRjUKTa46I2Z7eV62Rkhva+KkopW7Qvv/OSWBqvkSY7vusOPrNuZcUG3tApvdVgNB8POj3SPw==}
+ engines: {node: '>=10'}
+
resolution: {integrity: sha512-HvdH2LzI/EAZcUwA8+0nKNtWHqS+ZmijLA30RwZA0bo7ToCckjK5MkGhjED9KoRcXO6BaGI3I9UIzSA1FKFPOQ==}
@@ -8532,6 +8574,10 @@ packages:
resolution: {integrity: sha512-RdR9FQrFwNBNXAr4GixM8YaRZRJ5PUWbKYbE5eOsrwAjJW0q2REGcf79oYPsLyskQCZG1PLN+S/K1V00joZAoQ==}
+ resolution: {integrity: sha512-0eJJY6hXLGf1udHwfNftBqH+g73EU4B504nZeKpz1sYRKafAghwxEJunB2O7rDZkL4PGfsMVnTXZ2EjibbqcsA==}
+ engines: {node: '>=14.0.0'}
+
resolution: {integrity: sha512-oVlzkg3ENAhCk2zdv7IJwd/QUD4z2RxRwpkcGY8psCVcCYZNq4wYnVWALHM+brtuJjePWiYF/ClmuDr8Ch5+kg==}
engines: {node: '>= 0.8'}
@@ -8748,6 +8794,20 @@ packages:
resolution: {integrity: sha512-udgsAY+fTnvv7kI7aaxbqwWNb0AHiB0qBO89PZKPkoTmGOgdbrHDKD+0B2X4uTfJ/FT1R09r9gTsjUjNJotuog==}
engines: {node: '>=0.10.0'}
+ resolution: {integrity: sha512-wlfUczU+n7Hy/Ha5j9a/gZNy7We5+cXp8YL+X+PG8S0KXxw7n/JXA3c46Y0zQznIJ83URJiwy7Lh56WLokNuxg==}
+
+ resolution: {integrity: sha512-ttXRkkOz6WWC95KeY9+xxWL6AtImwbyMHrL1mSwqwW9u+vLp/WIElvHvCSDg0xO/Dzrggz1zv3rN5ovTRVowKg==}
+ hasBin: true
+
+ resolution: {integrity: sha512-BndPH67/JxGExRgiX1dX0w1FvZck5Wa4aal9198SrRhZjH3GxKQUKIBnYJTdj2HDN3UQAS06HlfcSbQj2OHmaw==}
+
+ resolution: {integrity: sha512-Tjyv76gdUe2460dEhtcnA4fU/+HhGq2Kr7OWlo2R/Xxbmn/ZNKWavNWTD2k97IE+s755iVU7WcaOEIl+H3cq8w==}
+ hasBin: true
+
resolution: {integrity: sha512-TfySrs/5nm8fQJDcBDuUng3VOUKsd7S+zqvbOTiGXHfxX4wK31ard+hoNuvkicM/2YFzlpDgABOevKSsB4G/FA==}
engines: {node: '>= 6'}
@@ -8898,6 +8958,9 @@ packages:
resolution: {integrity: sha512-3ouUOpQhtgrbOa17J7+uxOTpITYWaGP7/AhoR3+A+/1e9skrzelGi/dXzEYyvbxubEF6Wn2ypscTKiKJFFn1ag==}
+ resolution: {integrity: sha512-a39t9ApHNx2L4+HBnQKqxxHNs1r7KF+Intd8Q/g1bUh6q0WIp9voPXJ/x0j+ZL45KF1pJd9+q2jLIRMfvEshkA==}
+
resolution: {integrity: sha512-7PiHtLll5LdnKIMw100I+8xJXR5gW2QwWYkT6iJva0bXitZKa/XMrSbdmg3r2Xnaidz9Qumd0VPaMrZlF9V9sA==}
engines: {node: '>=0.4.0'}
@@ -8988,6 +9051,9 @@ packages:
resolution: {integrity: sha512-NuaNSa6flKT5JaSYQzJok04JzTL1CA6aGhv5rfLW3PgqA+M2ChpZQnAC8h8i4ZFkBS8X5RqkDBHA7r4hej3K9A==}
+ resolution: {integrity: sha512-tYC1Q1hgyRuHgloV/YXs2w15unPVh8qfu/qCTfhTYamaw7fyhumKa2yGpdSo87vY32rIclj+4fWYQXUMs9EHvg==}
+
resolution: {integrity: sha512-WuyALRjWPDGtt/wzJiadO5AXY+8hZ80hVpe6MyivgraREW751X3SbhRvG3eLKOYN+8VEvqLcf3wdnt44Z4S4SA==}
engines: {node: '>=10'}
@@ -9159,6 +9225,10 @@ packages:
resolution: {integrity: sha512-GDhwkLfywWL2s6vEjyhri+eXmfH6j1L7JE27WhqLeYzoh/A3DBaYGEj2H/HFZCn/kMfim73FXxEJTw06WtxQwg==}
engines: {node: '>= 14.18.0'}
+ resolution: {integrity: sha512-57frrGM/OCTLqLOAh0mhVA9VBMHd+9U7Zb2THMGdBUoZVOtGbJzjxsYGDJ3A9AYYCP4hn6y1TVbaOfzWtm5GFg==}
+ engines: {node: '>= 12.13.0'}
+
resolution: {integrity: sha512-8GtdyqaBcDfva+GUKDr3nev3VpKAhup1+RvkMvUxURHpW7QyIvk9F5wz7Vzo06CEMSilw6uArgRqhpiUcWp8ew==}
@@ -9401,6 +9471,10 @@ packages:
resolution: {integrity: sha512-ERq4hUjKDbJfE4+XtZLFPCDi8Vb1JqaxAPTxWFLBx8XcAlf9Bda/ZJdVezs/NAfsMQScyIlUMx+Yeu7P7rx5jw==}
+ resolution: {integrity: sha512-b3rppTKm9T+PsVCBEOUR46GWI7fdOs00VKZ1+9c1EWDaDMvjQc6tUwuFyIprgGgTcWoVHSKrU8H31ZHA2e0RHA==}
+ engines: {node: '>=10'}
+
resolution: {integrity: sha512-YZo3K82SD7Riyi0E1EQPojLz7kpepnSQI9IyPbHHg1XXXevb5dJI7tpyN2ADxGcQbHG7vcyRHk0cbwqcQriUtg==}
@@ -9429,6 +9503,9 @@ packages:
resolution: {integrity: sha512-vfD3pmTzGpufjScBh50YHKzEu2lxBWhVEHsNGoEXmCmn2hKGfeNLYMzCJpe8cD7gqX7TJluOVpBkAequ6dgMmA==}
engines: {node: '>=4'}
+ resolution: {integrity: sha512-l4KnYfEyqYJxDwlNVyRfO2E4NTHfMKAWdUuA8J0yve2Dz/E/PdBepY03RvyJpssIpRFwJoCD55wA+mEDs6ByWA==}
+
resolution: {integrity: sha512-5TF+l7p4+OsnP8BCCvSyZiSPc4x4//p5uPwK8TCnVPJYRmU2aYKMpOXvw8zM5a5JvuuCGN1jmsMwuU2W02ukfA==}
@@ -9612,6 +9689,9 @@ packages:
resolution: {integrity: sha512-D3YaD0aRxR3mEcqnidIs7ReYJFVzWdd6fXJYUM8ixcQcJRGTka/b3saV0KflYhyVJXKhb947GndU35SxYNResQ==}
engines: {node: '>= 10.0.0', npm: '>= 3.0.0'}
+ resolution: {integrity: sha512-INb7TM37/mAcsGmc9hyyI6+QR3rR1zVRu36B0NeGXKnOOLiZOfER5SA+N7X7k3yUYRzLWafduTDvJAfDswwEww==}
+
resolution: {integrity: sha512-yHFhk8T/DK3YxjFQXIrcHT1rGEeTLliVzWbO0xN8GberVun2RiBnxAjXAYpZrqwEVHBG9asI/Li8TAAhN9m59Q==}
peerDependencies:
@@ -9761,6 +9841,10 @@ packages:
resolution: {integrity: sha512-laJTa3Jb+VQpaC6DseHhF7dXVqHTfJPCRDaEbid/drOhgitgYku/letMUqOXFoWV0zIIUbjpdH2t+tYj4bQMRQ==}
engines: {node: '>=8'}
+ resolution: {integrity: sha512-1tB5mhVo7U+ETBKNf92xT4hrQa3pm0MZ0PQvuDnWgAAGHDsfp4lPSpiS6psrSiet87wyGPh9ft6wmhOMQ0hDiw==}
+ engines: {node: '>=14.16'}
+
resolution: {integrity: sha512-yPxVJxUzP1QHhHeFnYjJl48QwDS1+5befcL7ju7+t+i88D5r0rbsL+GkCCS6zgcU+TiV5bF9eMGcKyJfLf8BZQ==}
engines: {node: '>=12.*'}
@@ -9902,6 +9986,10 @@ packages:
resolution: {integrity: sha512-RVZSIV5IG10Hk3enotrhvz0T9em6cyHBLkH/YAZuKqd8hRkKhSfCGIcP2KUY0EPxndzANBmNllzWPwak+bheSw==}
+ resolution: {integrity: sha512-4iMVL6HAINXWf1ZKZjIPcz5wYaOdPhtO8ATvZ+Xqp3BTdaqtAwQkNmKORqcIo5YkQqGXq5cwfswDwMqqQNrpJA==}
+ engines: {node: '>=20'}
+
resolution: {integrity: sha512-dTEWWNu6JmeVXY0ZYoPuH5cRIwc0MeGbJwah9KUNYSJwommQpCzTySTpEe8Gs1J23aeWEuAobe4Ag7EHVt/LOg==}
engines: {node: '>=10'}
@@ -13602,6 +13690,8 @@ snapshots:
tslib: 2.8.1
webcrypto-core: 1.8.1
+ '@pinojs/[email protected]': {}
+
optional: true
@@ -16424,6 +16514,8 @@ snapshots:
+
dependencies:
stubborn-fs: 2.0.0
@@ -16884,6 +16976,8 @@ snapshots:
color-convert: 2.0.1
color-string: 1.9.1
+
dependencies:
delayed-stream: 1.0.0
@@ -17069,6 +17163,8 @@ snapshots:
+
@@ -17683,6 +17779,8 @@ snapshots:
dependencies:
pure-rand: 6.1.0
+
@@ -17699,6 +17797,8 @@ snapshots:
+
@@ -18295,6 +18395,8 @@ snapshots:
property-information: 7.0.0
space-separated-tokens: 2.0.2
+
@@ -18832,6 +18934,8 @@ snapshots:
+
@@ -19990,6 +20094,8 @@ snapshots:
+
dependencies:
ee-first: 1.1.1
@@ -20222,6 +20328,42 @@ snapshots:
+ dependencies:
+ split2: 4.2.0
+
+ dependencies:
+ colorette: 2.0.20
+ dateformat: 4.6.3
+ fast-copy: 4.0.2
+ fast-safe-stringify: 2.1.1
+ help-me: 5.0.0
+ joycon: 3.1.1
+ minimist: 1.2.8
+ on-exit-leak-free: 2.1.2
+ pino-abstract-transport: 3.0.0
+ pump: 3.0.2
+ secure-json-parse: 4.1.0
+ sonic-boom: 4.2.0
+ strip-json-comments: 5.0.3
+
+
+ dependencies:
+ '@pinojs/redact': 0.4.0
+ atomic-sleep: 1.0.0
+ on-exit-leak-free: 2.1.2
+ pino-abstract-transport: 3.0.0
+ pino-std-serializers: 7.1.0
+ process-warning: 5.0.0
+ quick-format-unescaped: 4.0.4
+ real-require: 0.2.0
+ safe-stable-stringify: 2.5.0
+ sonic-boom: 4.2.0
+ thread-stream: 4.0.0
+
@@ -20383,6 +20525,8 @@ snapshots:
+
@@ -20509,6 +20653,8 @@ snapshots:
+
@@ -20738,6 +20884,8 @@ snapshots:
+
dependencies:
'@types/estree': 1.0.7
@@ -21157,6 +21305,8 @@ snapshots:
+
@@ -21183,6 +21333,8 @@ snapshots:
extend-shallow: 2.0.1
kind-of: 6.0.3
+
dependencies:
parseley: 0.12.1
@@ -21503,6 +21655,10 @@ snapshots:
ip-address: 9.0.5
smart-buffer: 4.2.0
+ dependencies:
+ atomic-sleep: 1.0.0
+
dependencies:
react: 19.2.1
@@ -21653,6 +21809,8 @@ snapshots:
dependencies:
min-indent: 1.0.1
+
dependencies:
'@types/node': 24.10.9
@@ -21824,6 +21982,10 @@ snapshots:
dependencies:
any-promise: 1.3.0
+ dependencies:
+ real-require: 0.2.0
+