Chore: add pino pretty transport (#58)

* add pino pretty transport

* add NODE_ENV to .env file for type generation
This commit is contained in:
Baobeld 2025-01-22 12:47:13 -05:00 committed by GitHub
parent d783f87d4a
commit 43cc1b017c
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 15 additions and 2 deletions

2
.env
View file

@ -1,3 +1,5 @@
NODE_ENV=
# TWILIO
TWILIO_ACCOUNT_SID=
TWILIO_AUTH_TOKEN=

View file

@ -1,7 +1,18 @@
import { NODE_ENV } from '$env/static/private';
import { type YogaLogger } from 'graphql-yoga';
import pino from 'pino';
export const logger = pino();
export const logger = pino({
// Only use pino-pretty when NOT production
...(NODE_ENV !== 'production' && {
transport: {
target: 'pino-pretty',
options: {
colorize: true,
},
},
}),
});
export const yogaLogger: YogaLogger = {
debug(...args) {