Last active
April 15, 2020 08:26
-
-
Save HaNdTriX/dd443de4d29642a411b986e58cc6c56e to your computer and use it in GitHub Desktop.
Simple logging middleware for Apollo Client.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { ApolloLink } from 'apollo-link'; | |
const logLink = new ApolloLink((operation, forward) => { | |
console.time(operation.operationName); | |
return forward(operation).map(result => { | |
console.timeEnd(operation.operationName); | |
return result; | |
}); | |
}); | |
export default logLink; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment