add yoga logger
This commit is contained in:
parent
e06dc1ec94
commit
21634249d7
4 changed files with 28 additions and 1 deletions
BIN
bun.lockb
BIN
bun.lockb
Binary file not shown.
|
|
@ -52,6 +52,8 @@
|
|||
"@tailwindcss/typography": "^0.5.15",
|
||||
"graphql": "^16.9.0",
|
||||
"graphql-yoga": "^5.10.4",
|
||||
"pino": "^9.5.0",
|
||||
"pino-pretty": "^13.0.0",
|
||||
"storybook-dark-mode": "^4.0.2"
|
||||
}
|
||||
}
|
||||
|
|
|
|||
23
src/lib/logger/index.ts
Normal file
23
src/lib/logger/index.ts
Normal file
|
|
@ -0,0 +1,23 @@
|
|||
import { type YogaLogger } from 'graphql-yoga';
|
||||
import pino from 'pino';
|
||||
|
||||
export const logger = pino();
|
||||
|
||||
export const yogaLogger: YogaLogger = {
|
||||
debug(...args) {
|
||||
// @ts-expect-error types dont match
|
||||
logger.debug(...args);
|
||||
},
|
||||
info(...args) {
|
||||
// @ts-expect-error types dont match
|
||||
logger.info(...args);
|
||||
},
|
||||
warn(...args) {
|
||||
// @ts-expect-error types dont match
|
||||
logger.warn(...args);
|
||||
},
|
||||
error(...args) {
|
||||
// @ts-expect-error types dont match
|
||||
logger.error(...args);
|
||||
}
|
||||
};
|
||||
|
|
@ -1,3 +1,4 @@
|
|||
import { yogaLogger } from '$lib/logger';
|
||||
import { Schema } from '$lib/pothos';
|
||||
import type { RequestEvent } from '@sveltejs/kit';
|
||||
import { createYoga } from 'graphql-yoga';
|
||||
|
|
@ -6,5 +7,6 @@ export const Yoga = createYoga<RequestEvent>({
|
|||
schema: Schema,
|
||||
graphqlEndpoint: '/api/graphql',
|
||||
// Let Yoga use sveltekit's Response object
|
||||
fetchAPI: { Response }
|
||||
fetchAPI: { Response },
|
||||
logging: yogaLogger
|
||||
});
|
||||
Loading…
Add table
Reference in a new issue