🚀 Big News: Socket Acquires Coana to Bring Reachability Analysis to Every Appsec Team.Learn more
Socket
Book a DemoInstallSign in
Socket

apollo-logger

Package Overview
Dependencies
Maintainers
1
Versions
12
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

apollo-logger

Apollo GraphQL Logger

0.0.5
Source
npm
Version published
Weekly downloads
377
64.63%
Maintainers
1
Weekly downloads
 
Created
Source

Apollo GraphQL Logger

Installation

npm install --save-dev apollo-logger

Usage

For full logging you will need to attach Apollo Logger to:

  • Network interface
  • Subscription manager
  • And PubSub
import { addApolloLogging } from 'apollo-logger';

let networkInterface = addApolloLogging(createBatchingNetworkInterface({
  ...
}));

const pubsub = addApolloLogging(new PubSub());

const subscriptionManager = addApolloLogging(new SubscriptionManager(...));

Sample output

On each example the result of operation comes after =>

  • Query:
getPost({"id":"3"}) => {"data":{"post":{"id":"3","title":"Post title 3", "__typename":"Post"}}}
  • Mutation:
addCount({"amount":1}) => {"data":{"addCount":{"amount":17,"__typename":"Count"}}}
  • Subscription
onCountUpdated({}) => subscription: 2
  • Subscription message:
{"commentUpdated":{"mutation":"CREATED","id":"3003", ... ,"__typename":"UpdateCommentPayload"}}
  • Unsubscription
unsubscribe from subscription: 2
  • 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 postsUpdated => 2
  • PubSub unsubscribe on a server:
pubsub unsubscribe [ 2 ]
  • PubSub message generated on a server:
pubsub msg postsUpdated({"mutation":"CREATED","id":21,"node":{"id":21,"title":"New post 1"}})
  • PubSub filter check on a server:
pubsub filter postsUpdated(opts = {"query":...,"context":{}}, args = {"endCursor":10}, name = postsUpdated)
.postsUpdated(val = {"mutation":"CREATED","id":21,"node":{"id":21,"title":"New post 1"}}, ctx = {}) => true

License

Copyright © 2017 SysGears INC. This source code is licensed under the MIT license.

Keywords

apollo

FAQs

Package last updated on 22 Jun 2017

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts