refactor(logs): move to core package (#4586)
This commit is contained in:
@@ -1,10 +1,12 @@
|
||||
import { trpc } from "@homarr/api/server";
|
||||
import { createLogger } from "@homarr/core/infrastructure/logs";
|
||||
import { db, inArray } from "@homarr/db";
|
||||
import { apps } from "@homarr/db/schema";
|
||||
import { logger } from "@homarr/log";
|
||||
|
||||
import type { Prefetch } from "../definition";
|
||||
|
||||
const logger = createLogger({ module: "appWidgetPrefetch" });
|
||||
|
||||
const prefetchAllAsync: Prefetch<"app"> = async (queryClient, items) => {
|
||||
const appIds = items.map((item) => item.options.appId);
|
||||
const distinctAppIds = [...new Set(appIds)];
|
||||
@@ -17,7 +19,7 @@ const prefetchAllAsync: Prefetch<"app"> = async (queryClient, items) => {
|
||||
queryClient.setQueryData(trpc.app.byId.queryKey({ id: app.id }), app);
|
||||
}
|
||||
|
||||
logger.info(`Successfully prefetched ${dbApps.length} apps for app widget`);
|
||||
logger.info("Successfully prefetched apps for app widget", { count: dbApps.length });
|
||||
};
|
||||
|
||||
export default prefetchAllAsync;
|
||||
|
||||
@@ -1,10 +1,12 @@
|
||||
import { trpc } from "@homarr/api/server";
|
||||
import { createLogger } from "@homarr/core/infrastructure/logs";
|
||||
import { db, inArray } from "@homarr/db";
|
||||
import { apps } from "@homarr/db/schema";
|
||||
import { logger } from "@homarr/log";
|
||||
|
||||
import type { Prefetch } from "../definition";
|
||||
|
||||
const logger = createLogger({ module: "bookmarksWidgetPrefetch" });
|
||||
|
||||
const prefetchAllAsync: Prefetch<"bookmarks"> = async (queryClient, items) => {
|
||||
const appIds = items.flatMap((item) => item.options.items);
|
||||
const distinctAppIds = [...new Set(appIds)];
|
||||
@@ -24,7 +26,7 @@ const prefetchAllAsync: Prefetch<"bookmarks"> = async (queryClient, items) => {
|
||||
);
|
||||
}
|
||||
|
||||
logger.info(`Successfully prefetched ${dbApps.length} apps for bookmarks`);
|
||||
logger.info("Successfully prefetched apps for bookmarks", { count: dbApps.length });
|
||||
};
|
||||
|
||||
export default prefetchAllAsync;
|
||||
|
||||
Reference in New Issue
Block a user