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 {Page, PageContent, PageHeader, PageTitle} from "@/features/layout/page";
|
||||
import {db} from "@/db";
|
||||
import { logger } from "@/lib/logger";
|
||||
|
||||
const log = logger.child({ module: "dashboard/admin/settings" });
|
||||
import {notFound} from "next/navigation";
|
||||
import {SettingsTabs} from "@/components/wrappers/dashboard/admin/settings/settings-tabs";
|
||||
import {desc, isNull} from "drizzle-orm";
|
||||
@@ -14,7 +17,7 @@ export default async function RoutePage(props: PageParams<{}>) {
|
||||
where: (fields, {eq}) => eq(fields.name, "system"),
|
||||
});
|
||||
|
||||
console.log(settings)
|
||||
log.debug({ settings }, "Settings loaded");
|
||||
|
||||
const storageChannels = await db.query.storageChannel.findMany({
|
||||
with: {
|
||||
|
||||
+4
-1
@@ -1,6 +1,9 @@
|
||||
"use server";
|
||||
|
||||
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 {v4 as uuidv4} from "uuid";
|
||||
import {ServerActionResult} from "@/types/action-type";
|
||||
@@ -51,7 +54,7 @@ export const deleteProjectAction = userAction.schema(z.string()).action(async ({
|
||||
},
|
||||
};
|
||||
} catch (error) {
|
||||
console.log(error);
|
||||
log.error({ error }, "Failed to archive project");
|
||||
return {
|
||||
success: false,
|
||||
actionError: {
|
||||
|
||||
@@ -11,6 +11,9 @@ import {StorageChannel} from "@/db/schema/12_storage-channel";
|
||||
import {
|
||||
StorageChannelFormType
|
||||
} 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(
|
||||
@@ -103,7 +106,7 @@ export async function dispatchStorage(
|
||||
input,
|
||||
);
|
||||
|
||||
console.log(dispatchResult);
|
||||
log.debug({ result: dispatchResult }, "Storage dispatch result");
|
||||
return dispatchResult;
|
||||
|
||||
} catch (err: any) {
|
||||
|
||||
@@ -1,5 +1,8 @@
|
||||
"use server";
|
||||
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 {v4 as uuidv4} from "uuid";
|
||||
import {db} from "@/db";
|
||||
@@ -69,7 +72,7 @@ export const uploadUserImageAction = userAction.schema(
|
||||
}
|
||||
|
||||
const result = await dispatchStorage(input, undefined, settings.storageChannel.id);
|
||||
console.log(result);
|
||||
log.debug({ result }, "Upload dispatch result");
|
||||
if (!result.success) {
|
||||
return {
|
||||
success: false,
|
||||
|
||||
@@ -22,7 +22,9 @@ import {passkey} from "@better-auth/passkey";
|
||||
import {getOidcProviders} from "./oidc";
|
||||
import {APIError} from "better-auth/api";
|
||||
import {getOAuthProviders} from "./oauth";
|
||||
import { logger } from "@/lib/logger";
|
||||
|
||||
const log = logger.child({ module: "lib/auth" });
|
||||
|
||||
const oidcProviders = getOidcProviders();
|
||||
|
||||
@@ -438,9 +440,7 @@ export const auth = betterAuth({
|
||||
new Date(user.createdAt).getTime();
|
||||
|
||||
if (createdAtDiff < 5000) {
|
||||
console.log(
|
||||
`Skipping new login email for freshly created user ${user.email}`,
|
||||
);
|
||||
log.debug(`Skipping new login email for freshly created user ${user.email}`);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -471,12 +471,12 @@ export const auth = betterAuth({
|
||||
),
|
||||
});
|
||||
} catch (error) {
|
||||
console.log("sendEmail failed", {
|
||||
log.error({
|
||||
userId: user.id,
|
||||
details: "Please Check your env variables or system config",
|
||||
email: user.email,
|
||||
error,
|
||||
});
|
||||
}, "sendEmail failed");
|
||||
}
|
||||
|
||||
(await auth.$context).internalAdapter.updateUser(user.id, {
|
||||
@@ -784,7 +784,7 @@ export const getActiveMember = async () => {
|
||||
|
||||
return member as MemberWithUser;
|
||||
} catch (e) {
|
||||
console.log("err", e);
|
||||
log.error({ error: e }, "Auth error");
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
+1
-1
@@ -132,7 +132,7 @@ async function createDefaultOrganization() {
|
||||
}
|
||||
|
||||
function consoleAscii() {
|
||||
console.log(
|
||||
log.info(
|
||||
" \n" +
|
||||
" ____ __ __ \n" +
|
||||
" / __ \\____ _____/ /_____ _/ /_ ____ _________ \n" +
|
||||
|
||||
Reference in New Issue
Block a user