mirror of
https://github.com/Portabase/portabase.git
synced 2026-07-14 11:16:13 +02:00
fix: replace console.log with Pino logger in server-side files
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Sonnet 4.6
parent
592588ef76
commit
4f14d16452
@@ -1,6 +1,9 @@
|
|||||||
import {PageParams} from "@/types/next";
|
import {PageParams} from "@/types/next";
|
||||||
import {Page, PageContent, PageHeader, PageTitle} from "@/features/layout/page";
|
import {Page, PageContent, PageHeader, PageTitle} from "@/features/layout/page";
|
||||||
import {db} from "@/db";
|
import {db} from "@/db";
|
||||||
|
import { logger } from "@/lib/logger";
|
||||||
|
|
||||||
|
const log = logger.child({ module: "dashboard/admin/settings" });
|
||||||
import {notFound} from "next/navigation";
|
import {notFound} from "next/navigation";
|
||||||
import {SettingsTabs} from "@/components/wrappers/dashboard/admin/settings/settings-tabs";
|
import {SettingsTabs} from "@/components/wrappers/dashboard/admin/settings/settings-tabs";
|
||||||
import {desc, isNull} from "drizzle-orm";
|
import {desc, isNull} from "drizzle-orm";
|
||||||
@@ -14,7 +17,7 @@ export default async function RoutePage(props: PageParams<{}>) {
|
|||||||
where: (fields, {eq}) => eq(fields.name, "system"),
|
where: (fields, {eq}) => eq(fields.name, "system"),
|
||||||
});
|
});
|
||||||
|
|
||||||
console.log(settings)
|
log.debug({ settings }, "Settings loaded");
|
||||||
|
|
||||||
const storageChannels = await db.query.storageChannel.findMany({
|
const storageChannels = await db.query.storageChannel.findMany({
|
||||||
with: {
|
with: {
|
||||||
|
|||||||
+4
-1
@@ -1,6 +1,9 @@
|
|||||||
"use server";
|
"use server";
|
||||||
|
|
||||||
import {userAction} from "@/lib/safe-actions/actions";
|
import {userAction} from "@/lib/safe-actions/actions";
|
||||||
|
import { logger } from "@/lib/logger";
|
||||||
|
|
||||||
|
const log = logger.child({ module: "dashboard/delete-project.action" });
|
||||||
import {z} from "zod";
|
import {z} from "zod";
|
||||||
import {v4 as uuidv4} from "uuid";
|
import {v4 as uuidv4} from "uuid";
|
||||||
import {ServerActionResult} from "@/types/action-type";
|
import {ServerActionResult} from "@/types/action-type";
|
||||||
@@ -51,7 +54,7 @@ export const deleteProjectAction = userAction.schema(z.string()).action(async ({
|
|||||||
},
|
},
|
||||||
};
|
};
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.log(error);
|
log.error({ error }, "Failed to archive project");
|
||||||
return {
|
return {
|
||||||
success: false,
|
success: false,
|
||||||
actionError: {
|
actionError: {
|
||||||
|
|||||||
@@ -11,6 +11,9 @@ import {StorageChannel} from "@/db/schema/12_storage-channel";
|
|||||||
import {
|
import {
|
||||||
StorageChannelFormType
|
StorageChannelFormType
|
||||||
} from "@/components/wrappers/dashboard/admin/channels/channel/channel-form/channel-form.schema";
|
} from "@/components/wrappers/dashboard/admin/channels/channel/channel-form/channel-form.schema";
|
||||||
|
import { logger } from "@/lib/logger";
|
||||||
|
|
||||||
|
const log = logger.child({ module: "features/storages/dispatch" });
|
||||||
|
|
||||||
|
|
||||||
export async function dispatchStorage(
|
export async function dispatchStorage(
|
||||||
@@ -103,7 +106,7 @@ export async function dispatchStorage(
|
|||||||
input,
|
input,
|
||||||
);
|
);
|
||||||
|
|
||||||
console.log(dispatchResult);
|
log.debug({ result: dispatchResult }, "Storage dispatch result");
|
||||||
return dispatchResult;
|
return dispatchResult;
|
||||||
|
|
||||||
} catch (err: any) {
|
} catch (err: any) {
|
||||||
|
|||||||
@@ -1,5 +1,8 @@
|
|||||||
"use server";
|
"use server";
|
||||||
import {userAction} from "@/lib/safe-actions/actions";
|
import {userAction} from "@/lib/safe-actions/actions";
|
||||||
|
import { logger } from "@/lib/logger";
|
||||||
|
|
||||||
|
const log = logger.child({ module: "features/upload/upload.action" });
|
||||||
import {z} from "zod";
|
import {z} from "zod";
|
||||||
import {v4 as uuidv4} from "uuid";
|
import {v4 as uuidv4} from "uuid";
|
||||||
import {db} from "@/db";
|
import {db} from "@/db";
|
||||||
@@ -69,7 +72,7 @@ export const uploadUserImageAction = userAction.schema(
|
|||||||
}
|
}
|
||||||
|
|
||||||
const result = await dispatchStorage(input, undefined, settings.storageChannel.id);
|
const result = await dispatchStorage(input, undefined, settings.storageChannel.id);
|
||||||
console.log(result);
|
log.debug({ result }, "Upload dispatch result");
|
||||||
if (!result.success) {
|
if (!result.success) {
|
||||||
return {
|
return {
|
||||||
success: false,
|
success: false,
|
||||||
|
|||||||
@@ -22,7 +22,9 @@ import {passkey} from "@better-auth/passkey";
|
|||||||
import {getOidcProviders} from "./oidc";
|
import {getOidcProviders} from "./oidc";
|
||||||
import {APIError} from "better-auth/api";
|
import {APIError} from "better-auth/api";
|
||||||
import {getOAuthProviders} from "./oauth";
|
import {getOAuthProviders} from "./oauth";
|
||||||
|
import { logger } from "@/lib/logger";
|
||||||
|
|
||||||
|
const log = logger.child({ module: "lib/auth" });
|
||||||
|
|
||||||
const oidcProviders = getOidcProviders();
|
const oidcProviders = getOidcProviders();
|
||||||
|
|
||||||
@@ -438,9 +440,7 @@ export const auth = betterAuth({
|
|||||||
new Date(user.createdAt).getTime();
|
new Date(user.createdAt).getTime();
|
||||||
|
|
||||||
if (createdAtDiff < 5000) {
|
if (createdAtDiff < 5000) {
|
||||||
console.log(
|
log.debug(`Skipping new login email for freshly created user ${user.email}`);
|
||||||
`Skipping new login email for freshly created user ${user.email}`,
|
|
||||||
);
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -471,12 +471,12 @@ export const auth = betterAuth({
|
|||||||
),
|
),
|
||||||
});
|
});
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.log("sendEmail failed", {
|
log.error({
|
||||||
userId: user.id,
|
userId: user.id,
|
||||||
details: "Please Check your env variables or system config",
|
details: "Please Check your env variables or system config",
|
||||||
email: user.email,
|
email: user.email,
|
||||||
error,
|
error,
|
||||||
});
|
}, "sendEmail failed");
|
||||||
}
|
}
|
||||||
|
|
||||||
(await auth.$context).internalAdapter.updateUser(user.id, {
|
(await auth.$context).internalAdapter.updateUser(user.id, {
|
||||||
@@ -784,7 +784,7 @@ export const getActiveMember = async () => {
|
|||||||
|
|
||||||
return member as MemberWithUser;
|
return member as MemberWithUser;
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
console.log("err", e);
|
log.error({ error: e }, "Auth error");
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
+1
-1
@@ -132,7 +132,7 @@ async function createDefaultOrganization() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function consoleAscii() {
|
function consoleAscii() {
|
||||||
console.log(
|
log.info(
|
||||||
" \n" +
|
" \n" +
|
||||||
" ____ __ __ \n" +
|
" ____ __ __ \n" +
|
||||||
" / __ \\____ _____/ /_____ _/ /_ ____ _________ \n" +
|
" / __ \\____ _____/ /_____ _/ /_ ____ _________ \n" +
|
||||||
|
|||||||
Reference in New Issue
Block a user