Chore: add pino pretty transport (#58)
* add pino pretty transport * add NODE_ENV to .env file for type generation
This commit is contained in:
parent
d783f87d4a
commit
43cc1b017c
2 changed files with 15 additions and 2 deletions
2
.env
2
.env
|
|
@ -1,3 +1,5 @@
|
||||||
|
NODE_ENV=
|
||||||
|
|
||||||
# TWILIO
|
# TWILIO
|
||||||
TWILIO_ACCOUNT_SID=
|
TWILIO_ACCOUNT_SID=
|
||||||
TWILIO_AUTH_TOKEN=
|
TWILIO_AUTH_TOKEN=
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,18 @@
|
||||||
|
import { NODE_ENV } from '$env/static/private';
|
||||||
import { type YogaLogger } from 'graphql-yoga';
|
import { type YogaLogger } from 'graphql-yoga';
|
||||||
import pino from 'pino';
|
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 = {
|
export const yogaLogger: YogaLogger = {
|
||||||
debug(...args) {
|
debug(...args) {
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue