- Create new @link-stack/logger package wrapping Pino for structured logging - Replace all console.log/error/warn statements across the monorepo - Configure environment-aware logging (pretty-print in dev, JSON in prod) - Add automatic redaction of sensitive fields (passwords, tokens, etc.) - Remove dead commented-out logger file from bridge-worker - Follow Pino's standard argument order (context object first, message second) - Support log levels via LOG_LEVEL environment variable - Export TypeScript types for better IDE support This provides consistent, structured logging across all applications and packages, making debugging easier and production logs more parseable.
45 lines
1.2 KiB
TypeScript
45 lines
1.2 KiB
TypeScript
import { Metadata } from "next";
|
|
import { redirect } from "next/navigation";
|
|
import { Home } from "./_components/Home";
|
|
import { createLogger } from "@link-stack/logger";
|
|
|
|
const logger = createLogger('link-page');
|
|
// import { getServerSession } from "app/_lib/authentication";
|
|
// import { Home } from "@link-stack/leafcutter-ui";
|
|
// import { getUserVisualizations } from "@link-stack/opensearch-common";
|
|
// import { LeafcutterWrapper } from "@link-stack/leafcutter-ui";
|
|
|
|
export const metadata: Metadata = {
|
|
title: "CDR Link - Home",
|
|
};
|
|
|
|
export default async function Page() {
|
|
const leafcutterEnabled = process.env.LEAFCUTTER_ENABLED === "true";
|
|
const dashboardURL = process.env.LEAFCUTTER_DEFAULT_DASHBOARD_URL;
|
|
|
|
if (!leafcutterEnabled) {
|
|
redirect("/overview/recent");
|
|
}
|
|
/*
|
|
const session = await getServerSession();
|
|
const {
|
|
user: { email },
|
|
}: any = session;
|
|
*/
|
|
let visualizations = [];
|
|
/*
|
|
try {
|
|
visualizations = await getUserVisualizations(email ?? "none", 20);
|
|
} catch (e) {
|
|
logger.error({ meta: e.meta }, "Error metadata");
|
|
}
|
|
|
|
return (
|
|
<LeafcutterWrapper>
|
|
<Home visualizations={visualizations} showWelcome={false} />
|
|
</LeafcutterWrapper>
|
|
);
|
|
*/
|
|
|
|
return <Home url={dashboardURL} />;
|
|
}
|