diff --git a/app/global.d.ts b/app/global.d.ts new file mode 100644 index 0000000..afa7aef --- /dev/null +++ b/app/global.d.ts @@ -0,0 +1 @@ +declare const EdgeRuntime: string | undefined diff --git a/lib/logger.ts b/lib/logger.ts index b32fdaa..3d617d4 100644 --- a/lib/logger.ts +++ b/lib/logger.ts @@ -2,6 +2,8 @@ import { type TransportTargetOptions, pino } from 'pino' const targets: TransportTargetOptions[] = [] +const isEdge = typeof EdgeRuntime === 'string' + if (process.env.NODE_ENV !== 'production') { targets.push({ target: 'pino-pretty', @@ -18,6 +20,7 @@ const transport = pino.transport({ export const logger = pino( { level: process.env.LOG_LEVEL || 'info', + ...(isEdge && { browser: { asObject: true } }), }, transport, )