From 4f4f6928dab2cfaf120572a04ef847f6ee03bd35 Mon Sep 17 00:00:00 2001 From: Arian Pradana Date: Tue, 3 Sep 2024 07:45:10 +0700 Subject: [PATCH] Fix: Improve pino logger usage in safe-action.ts --- apps/app/src/actions/safe-action.ts | 6 +++--- packages/logger/src/index.ts | 4 +++- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/apps/app/src/actions/safe-action.ts b/apps/app/src/actions/safe-action.ts index 1ff57470..3a32d4b0 100644 --- a/apps/app/src/actions/safe-action.ts +++ b/apps/app/src/actions/safe-action.ts @@ -47,9 +47,9 @@ export const authActionClient = actionClientWithMeta const result = await next({ ctx: {} }); if (process.env.NODE_ENV === "development") { - logger("Input ->", clientInput); - logger("Result ->", result.data); - logger("Metadata ->", metadata); + logger.info(`Input -> ${JSON.stringify(clientInput)}`); + logger.info(`Result -> ${JSON.stringify(result.data)}`); + logger.info(`Metadata -> ${JSON.stringify(metadata)}`); return result; } diff --git a/packages/logger/src/index.ts b/packages/logger/src/index.ts index c6bbbe4f..ed264202 100644 --- a/packages/logger/src/index.ts +++ b/packages/logger/src/index.ts @@ -1 +1,3 @@ -export const logger = require("pino")(); +import pino from "pino"; + +export const logger = pino();