Last active
March 17, 2019 09:33
-
-
Save timjbray/b9aca6843d7c4ebb89ebca7f739111b4 to your computer and use it in GitHub Desktop.
This file contains 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
const server = new ApolloServer({ | |
typeDefs, | |
resolvers, | |
context: graphQLContext, | |
formatError: (error: any) => { | |
// filter whatever errors your don't want to log | |
logger.error(`[GraphQL.error] ${error.message}`, error); | |
return error; | |
}, | |
formatResponse: (response: any) => { | |
// don't auth mutations or schema requests | |
const name = Object.keys(get(response, 'data') || { unknown: 0 })[0]; | |
if (!['authSignIn', 'authRefreshToken', '__schema', ... ].includes(name)) { | |
logger.debug(`[GraphQL.response] ${name}()`, response); | |
} | |
return response; | |
} | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment