Skip to content

Commit

Permalink
rka-34: add browser
Browse files Browse the repository at this point in the history
  • Loading branch information
konstrybakov committed Jun 16, 2024
1 parent 32866f5 commit 7b304f0
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 0 deletions.
1 change: 1 addition & 0 deletions app/global.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
declare const EdgeRuntime: string | undefined
3 changes: 3 additions & 0 deletions lib/logger.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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',
Expand All @@ -18,6 +20,7 @@ const transport = pino.transport({
export const logger = pino(
{
level: process.env.LOG_LEVEL || 'info',
...(isEdge && { browser: { asObject: true } }),
},
transport,
)

0 comments on commit 7b304f0

Please sign in to comment.