A console logger link for Apollo Client. Logs request and response of queries and mutations to console.
npm install @freewall/apollo-console-logger
import { ConsoleLoggerLink } from '@freewall/apollo-console-logger';
const link = ApolloLink.from([
new ConsoleLoggerLink(),
new HttpLink({
uri: '...',
}),
]);
const client = new ApolloClient({
link,
// ...
});
// default values:
new ConsoleLoggerLink({
colors: {
query: {
request: '#E17E00',
response: '#A65D00',
},
mutation: {
request: '#E10098',
response: '#A5006F',
},
},
multiline: false,
responseSize: true,
responseTime: true,
});