diff --git a/packages/client/src/client.ts b/packages/client/src/client.ts index 7761de84c..09f9095cc 100644 --- a/packages/client/src/client.ts +++ b/packages/client/src/client.ts @@ -84,7 +84,7 @@ class Client { throw await BigCommerceAPIError.createFromResponse(response); } - log(); + log(response); return response.json() as Promise>; } @@ -135,12 +135,16 @@ class Client { const timeStart = Date.now(); - return () => { + return (response: Response) => { const timeEnd = Date.now(); const duration = timeEnd - timeStart; + const complexity = response.headers.get('x-bc-graphql-complexity'); + // eslint-disable-next-line no-console - console.log(`[BigCommerce] ${type} ${name ?? 'anonymous'} - ${duration}ms`); + console.log( + `[BigCommerce] ${type} ${name ?? 'anonymous'} - ${duration}ms - complexity ${complexity ?? 'unknown'}`, + ); }; } }