Docs

Get Started

Logger#

You can improve the development experience using a Logger of your GQty usage, which will print relevant information about the requests made to your GraphQL API Server.

Logger screenshot

Installation#

yarn add @gqty/logger

Usage#

You can add the logger alongside the generated client, or import it from another file

// /src/gqty/index.ts // ... export const client = createClient< GeneratedSchema, SchemaObjectTypesNames, SchemaObjectTypes >({ schema: generatedSchema, scalarsEnumsHash, queryFetcher, }); if (process.env.NODE_ENV === 'development' && typeof window !== 'undefined') { import('@gqty/logger').then(({ createLogger }) => { const logger = createLogger(client, { // Custom options... }); logger.start(); }); }

Options#

NameTypeDefault ValueDescription
showSelectionsbooleantrueShow "selections" in logs
showCachebooleantrueShow cache snapshots in logs
stringifyJSONbooleanfalseStringify JSON before printing it