Replace Logger with getLogger and update next version

This commit replaces the use of Logger with getLogger in various parts of the code to handle logging. The Logger has been replaced with getLogger, which assists in getting logs in an asynchronous manner. In addition to this, it updates the next version in pnpm-lock.yaml from next@14.2.0-canary.61 to next@14.2.0-canary.62 and various other dependencies. Also made minor annotations and comments to the function 'isBrowser' and 'formatCurrency' in the 'utils.ts' file.
This commit is contained in:
giancarlo
2024-04-08 12:23:15 +08:00
parent 2b447167f7
commit 9fca45c2de
33 changed files with 369 additions and 250 deletions

View File

@@ -4,7 +4,7 @@ import { redirect } from 'next/navigation';
import { z } from 'zod';
import { Logger } from '@kit/shared/logger';
import { getLogger } from '@kit/shared/logger';
import { requireUser } from '@kit/supabase/require-user';
import { getSupabaseServerActionClient } from '@kit/supabase/server-actions-client';
@@ -31,6 +31,7 @@ export async function createOrganizationAccountAction(
redirect(auth.redirectTo);
}
const logger = await getLogger();
const userId = auth.data.id;
const createAccountResponse = await service.createNewOrganizationAccount({
@@ -39,7 +40,7 @@ export async function createOrganizationAccountAction(
});
if (createAccountResponse.error) {
Logger.error(
logger.error(
{
userId,
error: createAccountResponse.error,
@@ -51,6 +52,15 @@ export async function createOrganizationAccountAction(
throw new Error('Error creating team account');
}
logger.info(
{
userId,
accountName,
name: 'accounts',
},
`Team account created successfully`,
);
const accountHomePath =
TEAM_ACCOUNTS_HOME_PATH + '/' + createAccountResponse.data.slug;