Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/egorlem/apollo-link-printer

Pretty logger of Apollo GraphQL network operations
https://github.com/egorlem/apollo-link-printer

apollo apollo-client apollo-link apollographql graphql

Last synced: 21 days ago
JSON representation

Pretty logger of Apollo GraphQL network operations

Awesome Lists containing this project

README

        

# Apollo link Printer

**Pretty logger of Apollo GraphQL network operations**

![NPM Version](https://img.shields.io/npm/v/apollo-link-printer) ![NPM License](https://img.shields.io/npm/l/apollo-link-printer)

---

![Preview](https://raw.githubusercontent.com/egorlem/apollo-link-printer/main/doc/preview.d.png)

---

### Installation
Node Package Manager installation
```bash
npm install apollo-link-printer
```
Yarn installation
```bash
yarn add apollo-link-printer
```
---

### Usage

```js
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:

```bash
npm install # or `yarn`
```
To run the library locally in another project, you can do the following:

```bash
npm link

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

License [MIT](https://github.com/egorlem/apollo-link-printer/blob/8d706dceb29d9c5ef85b5cd315efefcb4d924d48/LICENSE.md) © [Egor Lem](https://egorlem.com/)