- 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.
24 lines
584 B
TypeScript
24 lines
584 B
TypeScript
"use server";
|
|
|
|
import { executeREST } from "app/_lib/zammad";
|
|
import { createLogger } from "@link-stack/logger";
|
|
|
|
const logger = createLogger('link-groups');
|
|
|
|
export const getGroupsAction = async () => {
|
|
try {
|
|
const groups = await executeREST({
|
|
path: "/api/v1/groups",
|
|
});
|
|
const allGroups = groups ?? [];
|
|
const formattedGroups = allGroups.map((group: any) => ({
|
|
label: group.name,
|
|
value: `gid://zammad/Group/${group.id}`,
|
|
}));
|
|
|
|
return formattedGroups;
|
|
} catch (e) {
|
|
logger.error({ error: e }, "Error occurred");
|
|
return [];
|
|
}
|
|
};
|