New Research: Supply Chain Attack on Axios Pulls Malicious Dependency from npm.Details →
Socket
Book a DemoSign in
Socket

@debugr/apollo

Package Overview
Dependencies
Maintainers
2
Versions
14
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@debugr/apollo

Apollo server plugin for Advanced application logger

latest
npmnpm
Version
3.0.0-rc.9
Version published
Maintainers
2
Created
Source

Apollo Server plugin for Debugr

This plugin provides GraphQL query logging for Apollo Server.

Installation

npm install --save @debugr/apollo

Usage

Standalone Apollo Server:

import { ApolloServer } from 'apollo-server';
import { Logger, LogLevel } from '@debugr/core';
import { ApolloCollector } from '@debugr/apollo';
import { ConsoleHandler } from '@debugr/console';

const globalContext = {
  applicationName: 'example',
};

const logger = new Logger(globalContext, [
  new ConsoleHandler({
    threshold: LogLevel.INFO,
  }),
  new ApolloCollector(),
]);

const server = new ApolloServer({
  // typeDefs, resolvers, ...
  plugins: [
    logger.getPlugin('apollo'),
  ],
});

With Express integration and plugin:

import { ApolloServer } from 'apollo-server-express';
import * as express from 'express';
import { Logger, LogLevel } from '@debugr/core';
import { ExpressCollector } from '@debugr/express';
import { ApolloCollector } from '@debugr/apollo';
import { ConsoleHandler } from '@debugr/console';

const globalContext = {
  applicationName: 'example',
};

const logger = new Logger(globalContext, [
  new ConsoleHandler({
    threshold: LogLevel.INFO,
  }),
  new ExpressCollector(),
  new ApolloCollector(),
]);

const app = express();

const server = new ApolloServer({
  // typeDefs, resolvers, ...
  plugins: [
    debug.getPlugin('apollo'),
  ],
});

app.use(logger.getPlugin('express').createRequestHandler());

server.applyMiddleware({ app });

app.use(logger.getPlugin('express').createErrorHandler());

app.listen(8000);

Options

The ApolloCollector constructor accepts an optional options object with the following keys as the first argument:

OptionTypeDefaultDescription
levelLogLevelLogLevel.INFOThe level at which GraphQL queries are logged.

FAQs

Package last updated on 15 Aug 2023

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