Skip to content

egorlem/apollo-link-printer

Repository files navigation

Apollo link Printer

Pretty logger of Apollo GraphQL network operations

NPM Version NPM License


Preview


Installation

Node Package Manager installation

npm install apollo-link-printer

Yarn installation

yarn add apollo-link-printer

Usage

import { PrinterLink } from 'apollo-link-printer';

// See options
const options = {
  print: true,
}

const client = new ApolloClient({
  link: ApolloLink.from([
    new PrinterLink(options),
    new HttpLink({ uri: 'http://localhost:4000' }),
  ]),
  cache: new InMemoryCache(),
});

Options

name type explanation
print boolean if true, information will be output to the console
collapsed boolean if true, console.groupCollapsed will be used, otherwise console.group

Contributing

This project uses TypeScript to bring static types to JavaScript and uses Jest for testing. To get started, clone the repo and run the following commands:

npm install # or `yarn`

To run the library locally in another project, you can do the following:

npm link

# in the project you want to run this in
npm link apollo-link-printer

License MIT : Egor Lem