Socket
Socket
Sign inDemoInstall

apollo-log

Package Overview
Dependencies
134
Maintainers
1
Versions
7
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    apollo-log

A logging plugin for Apollo GraphQL Server


Version published
Weekly downloads
1.2K
decreased by-39.49%
Maintainers
1
Install size
7.00 MB
Created
Weekly downloads
 

Readme

Source
Apollo Server

tests cover size

apollo-log

A logging plugin for Apollo GraphQL Server

:heart: Please consider Sponsoring my work

apollo-server doesn't ship with any comprehensive logging, and instead offloads that responsiblity to the users and the resolvers or context handler This module provides uniform logging for the entire GraphQL request lifecycle, as provided by plugin hooks in apollo-server. The console/terminal result of which will resemble the image below:

Requirements

apollo-log is an evergreen 🌲 module.

This module requires an Active LTS Node version (v10.23.1+).

Install

Using npm:

npm install apollo-log

Usage

Setting up apollo-log is straight-forward. Import and call the plugin function, passing any desired options, and pass the plugin in an array to apollo-server.

import { ApolloLogPlugin } from 'apollo-log';
import { ApolloServer } from 'apollo-server';

const options = { ... };
const plugins = [ApolloLogPlugin(options)];
const apollo = new ApolloServer({
  plugins,
  ...
});

Please see the Apollo Plugins documentation for more information.

Options

events

Type: Record<string, boolean>
Default:

{
  didEncounterErrors: true,
  didResolveOperation: false,
  executionDidStart: false,
  parsingDidStart: false,
  responseForOperation: false,
  validationDidStart: false,
  willSendResponse: true
}

Specifies which Apollo lifecycle events will be logged. The requestDidStart event is always logged, and by default didEncounterErrors and willSendResponse are logged.

mutate

Type: Function Default: (data: Record<string, string>) => Record<string, string>

If specified, allows inspecting and mutating the data logged to the console for each message.

prefix

Type: String
Default: apollo

Specifies a prefix, colored by level, prepended to each log message.

timestamp

Type: Boolean

If true, will prepend a timestamp in the HH:mm:ss format to each log message.

Meta

CONTRIBUTING

LICENSE (Mozilla Public License)

Keywords

FAQs

Last updated on 09 Oct 2021

Did you know?

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

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc