This package has been deprecated

Author message:

Not maintained

@kiwicom/graphql-logz

0.10.0 • Public • Published

PLEASE NOTE: This package is still experimental and the API will most likely change.

Installation

yarn add @kiwicom/graphql-logz

Usage

You have to set LOGZIO_TOKEN environment variable. Then just call the recordRequest function somewhere in your application (end of life-cycle):

import Logger from '@kiwicom/graphql-logz';

const logger = new Logger({
  origin: 'service-name.kiwi.com', // required
  logzioToken: process.env.LOGZIO_TOKEN, // required
});

// to this as soon as possible (first middleware for example)
const startAt = process.hrtime.bigint();

// ...

logger.recordRequest({
  query: '{ __typename }',
  variables: {},
  operationName: undefined,
  result: {
    data: {
      __typename: 'RootQuery',
    },
  },
  startAt,
});

Logging deprecated fields

You are going to need @kiwicom/graphql-resolve-wrapper for this. This package will allow you to wrap the resolvers and do whatever you want to do:

function wrapper(resolveFn, field) {
  return (parent, args, context, info) => {
    logger.recordDeprecatedField(field, info ? info.path : null);
    return resolveFn(parent, args, context, info);
  };
}

wrapResolvers(Schema, wrapper);

Readme

Keywords

none

Package Sidebar

Install

npm i @kiwicom/graphql-logz

Weekly Downloads

0

Version

0.10.0

License

MIT

Unpacked Size

21.9 kB

Total Files

27

Last publish

Collaborators

  • mvidalgarcia
  • dsil
  • jakubzaba
  • robincsl_kiwi
  • kiwicom.platform
  • dinodsaurus