Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
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.6
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
330
increased by47.98%
Maintainers
1
Weekly downloads
 
Created
Source

Apollo GraphQL Logger

Twitter Follow

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

FAQs

Package last updated on 19 Sep 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

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc