apollo-link-log

Log side effect for Apollo Link.

Usage no npm install needed!

<script type="module">
  import apolloLinkLog from 'https://cdn.skypack.dev/apollo-link-log';
</script>

README

apollo-link-log

Log side effect for Apollo Link.

Travis Codecov Status npm package npm downloads

prettier license

Installation

$ yarn add apollo-link-log apollo-link graphql

Usage

import createLogLink from 'apollo-link-log';

// Default
ApolloLink.concat(createLogLink());

// With options
ApolloLink.concat(createLogLink({
  enabled: process.env.NODE_ENV !== 'production',
  logger: ({ operation, operationName, query, variables }) => {...};
}));

Snapshot

Options

type Options = {
  enabled?: boolean,
  logger?: (params: {
    operation: Object,
    operationName: ?string,
    query: string,
    variables: Object,
  }) => void,
};

Inspiration

Development

Requirements

  • node >= 11.9.0
  • yarn >= 1.13.0
  • apollo-link ^1.0.0
  • graphql ^14.0.0
$ yarn install --pure-lockfile
$ yarn start

Test

$ yarn run format
$ yarn run eslint
$ yarn run flow
$ yarn run test:watch
$ yarn run build

Publish

$ npm version patch
$ npm run changelog
git commit & push

CONTRIBUTING

  • ⇄ Pull requests and ★ Stars are always welcome.
  • For bugs and feature requests, please create an issue.
  • Pull requests must be accompanied by passing automated tests.

CHANGELOG

LICENSE

MIT: http://michaelhsu.mit-license.org