Skip to content

Commit

Permalink
fix: impl gqlInfo namespace, rm old eslint directives
Browse files Browse the repository at this point in the history
  • Loading branch information
trevor-anderson committed Feb 20, 2024
1 parent 340e1fc commit e780362
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions src/app/ApolloProvider/apolloLink/links/link.logger.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,22 +7,22 @@ import { logger } from "@/utils/logger";
*/
export const loggerLink = new ApolloLink((operation, forward) => {
const { operationName } = operation;
// VSCode's GQL extension misinterprets `logger.gql( ... )` as a `gql` template string
// eslint-disable-next-line @typescript-eslint/dot-notation
logger["gql"](`Starting operation "${operationName}"...`);

logger.gqlInfo(`Starting operation "${operationName}"...`);

operation.setContext({ start: Date.now() });

return forward(operation).map((response) => {
const responseTime = Date.now() - operation.getContext().start;
const responseTimeLogMsg = `Operation "${operationName}" completed in ${responseTime} ms`;
// VSCode's GQL extension misinterprets `logger.gql( ... )` as a `gql` template string
// eslint-disable-next-line @typescript-eslint/dot-notation
logger["gql"](

logger.gqlInfo(
responseTimeLogMsg +
(operationName !== "IntrospectionQuery"
? `, response = ${safeJsonStringify(response, null, 2)}`
: "")
);

return response;
});
});

0 comments on commit e780362

Please sign in to comment.