-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
87ef8c8
commit f628059
Showing
4 changed files
with
38 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,31 @@ | ||
import { pino } from 'pino' | ||
import { type TransportTargetOptions, pino } from 'pino' | ||
|
||
export const logger = pino({ | ||
level: process.env.LOG_LEVEL || 'info', | ||
const targets: TransportTargetOptions[] = [ | ||
{ | ||
target: 'pino-pretty', | ||
options: { | ||
colorize: true, | ||
}, | ||
}, | ||
] | ||
|
||
if (process.env.NODE_ENV === 'production') { | ||
targets.push({ | ||
target: '@axiomhq/pino', | ||
options: { | ||
dataset: process.env.AXIOM_DATASET, | ||
token: process.env.AXIOM_API_TOKEN, | ||
}, | ||
}) | ||
} | ||
|
||
const transport = pino.transport({ | ||
targets, | ||
}) | ||
|
||
export const logger = pino( | ||
{ | ||
level: process.env.LOG_LEVEL || 'info', | ||
}, | ||
transport, | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,8 @@ | ||
/** @type {import('next').NextConfig} */ | ||
const nextConfig = {}; | ||
const nextConfig = { | ||
experimental: { | ||
serverComponentsExternalPackages: ['pino', 'pino-pretty', '@axiomhq/pino'] | ||
} | ||
}; | ||
|
||
export default nextConfig; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters