Apollo GraphQL Logger
Installation
npm install --save-dev apollo-logger
Usage
For full logging you will need to attach Apollo Logger to:
- Apollo Link
- Apollo Express Server
- And PubSub
;const logOptions = logger: consolelog ;const link = ApolloLink;...app
Sample output
On each example the result of operation comes after =>
- Query:
"data":"post":"id":20"title":"Post title 20""content":"Post content 20""__typename":"Post""comments":"id":39"content":"Comment title 1 for post 20""__typename":"Comment""id":40"content":"Comment title 2 for post 20""__typename":"Comment" <=
- Mutation:
"data":"addCounter":"amount":21"__typename":"Counter" <=
- Subscription
subscribe <=
- Subscription message:
"data":"counterUpdated":"amount":21"__typename":"Counter" <= onCounterUpdated
- Unsubscription
unsubscribe <=
- PubSub publish on a server:
pubsub publish 'countUpdated'id: 1 created_at: null updated_at: null amount: 7
- PubSub subscribe on a server:
pubsub subscribe 2
- PubSub unsubscribe on a server:
pubsub unsubscribe 2
- PubSub message generated on a server:
pubsub msg
License
Copyright © 2017 SysGears INC. This source code is licensed under the MIT license.