UNPKG

@graphql-mesh/serve-runtime

Version:
19 lines (18 loc) 627 B
export function useFetchDebug(opts) { return { onFetch({ url, options, logger = opts.logger }) { logger = logger.child('fetch'); logger.debug('request', JSON.stringify({ url, ...(options || {}), }, null, ' ')); return function onFetchDone({ response }) { logger.debug('response', () => JSON.stringify({ url, status: response.status, headers: Object.fromEntries(response.headers.entries()), }, null, ' ')); }; }, }; }