Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

apollo-log

Package Overview
Dependencies
Maintainers
1
Versions
7
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

apollo-log - npm Package Compare versions

Comparing version 0.2.0 to 1.0.0

dist/index.d.ts

113

package.json
{
"name": "apollo-log",
"version": "0.2.0",
"description": "A logging extension for Apollo GraphQL Server",
"version": "1.0.0",
"description": "A logging plugin for Apollo GraphQL Server",
"license": "MPL-2.0",
"repository": "shellscape/apollo-log",
"author": "shellscape",
"author": "Andrew Powell <andrew@shellscape.org>",
"homepage": "https://github.com/shellscape/apollo-log",

@@ -12,61 +12,87 @@ "bugs": "https://github.com/shellscape/apollo-log/issues",

"engines": {
"node": ">= 10.0.0"
"node": ">= 10.23.1"
},
"scripts": {
"ci:coverage": "nyc npm run test && nyc report --reporter=text-lcov > coverage.lcov",
"ci:lint": "npm run lint && npm run security",
"ci:lint:commits": "commitlint --from=${CIRCLE_BRANCH} --to=${CIRCLE_SHA1}",
"ci:test": "npm run test -- --verbose",
"commitlint": "commitlint",
"commitmsg": "commitlint -e $GIT_PARAMS",
"lint": "eslint --fix --cache lib test",
"build": "tsc --project tsconfig.json",
"ci:coverage": "nyc pnpm ci:test && nyc report --reporter=text-lcov > coverage.lcov",
"ci:lint": "pnpmlint && pnpm security",
"ci:test": "pnpm test -- --verbose",
"lint": "pnpm lint:docs && pnpm lint:json && pnpm lint:package && pnpm lint:js",
"lint-staged": "lint-staged",
"security": "npm audit",
"lint:docs": "prettier --single-quote --arrow-parens avoid --trailing-comma none --write README.md",
"lint:js": "eslint --fix --cache src test",
"lint:json": "prettier --write codecov.yml .circleci/config.yml .eslintrc.js",
"lint:package": "prettier --write package.json --plugin=prettier-plugin-package",
"prepublishOnly": "pnpm lint && pnpm build",
"pretest": "pnpm build",
"security": "pnpm audit --audit-level=moderate",
"test": "ava"
},
"files": [
"lib/",
"dist/",
"README.md",
"LICENSE",
"index.d.ts"
"LICENSE"
],
"dependencies": {
"chalk": "^2.4.2",
"graphql": "^14.3.1",
"loglevelnext": "^3.0.1"
},
"devDependencies": {
"@commitlint/cli": "^8.3.5",
"@commitlint/config-conventional": "^8.0.0",
"apollo-boost": "^0.3.1",
"apollo-server": "^2.6.1",
"ava": "^2.0.0",
"eslint": "^5.6.1",
"eslint-config-shellscape": "^2.0.2",
"isomorphic-unfetch": "^3.0.0",
"lint-staged": "^8.1.0",
"nyc": "^14.1.1",
"pre-commit": "^1.2.2",
"prettier": "^1.14.3",
"sinon": "^7.3.2",
"standard-version": "^6.0.1"
},
"keywords": [
"apollo",
"apollo extension",
"apollo plugin",
"apollo-server",
"extension",
"graphql",
"log",
"logger",
"plugin",
"server"
],
"dependencies": {
"apollo-server-plugin-base": "^0.10.4",
"chalk": "^4.1.0",
"fast-safe-stringify": "^2.0.7",
"loglevelnext": "^4.0.1",
"nanoid": "^3.1.20"
},
"devDependencies": {
"@commitlint/cli": "^11.0.0",
"@commitlint/config-conventional": "^11.0.0",
"@types/sinon": "^9.0.10",
"@typescript-eslint/eslint-plugin": "^4.14.0",
"@typescript-eslint/parser": "^4.14.0",
"apollo-boost": "^0.4.9",
"apollo-server": "^2.19.2",
"ava": "^3.15.0",
"eslint": "^7.18.0",
"eslint-config-shellscape": "^3.0.0",
"eslint-plugin-prettier": "^3.3.1",
"isomorphic-unfetch": "^3.1.0",
"lint-staged": "^10.5.3",
"nyc": "^15.1.0",
"pre-commit": "^1.2.2",
"prettier": "^2.2.1",
"prettier-plugin-package": "^1.3.0",
"sinon": "^9.2.4",
"ts-node": "^9.1.1",
"tslib": "^2.1.0",
"typescript": "^4.1.3"
},
"ava": {
"helpers": [
"**/helpers/**/*"
"extensions": [
"ts"
],
"files": [
"!**/fixtures/**",
"!**/helpers/**"
],
"require": [
"ts-node/register"
]
},
"pre-commit": "lint-staged",
"jest": {
"testEnvironment": "node",
"coverageDirectory": "./coverage/",
"collectCoverage": true
},
"lint-staged": {
"*.js": [
"eslint --fix",
"git add"
"eslint --fix"
]

@@ -76,10 +102,9 @@ },

"include": [
"lib/*.js"
"src/*.ts"
],
"exclude": [
"lib/client*.js",
"test/"
]
},
"types": "index.d.ts"
"pre-commit": "lint-staged"
}

@@ -1,10 +0,8 @@

[tests]: https://img.shields.io/circleci/project/github/shellscape/webpack-plugin-serve.svg
[tests-url]: https://circleci.com/gh/shellscape/webpack-plugin-serve
[tests]: https://img.shields.io/circleci/project/github/shellscape/apollo-log.svg
[tests-url]: https://circleci.com/gh/shellscape/apollo-log
[cover]: https://codecov.io/gh/shellscape/apollo-log/branch/master/graph/badge.svg
[cover-url]: https://codecov.io/gh/shellscape/apollo-log
[size]: https://packagephobia.now.sh/badge?p=apollo-log
[size-url]: https://packagephobia.now.sh/result?p=apollo-log
[cover]: https://codecov.io/gh/shellscape/webpack-plugin-serve/branch/master/graph/badge.svg
[cover-url]: https://codecov.io/gh/shellscape/webpack-plugin-serve
[size]: https://packagephobia.now.sh/badge?p=webpack-plugin-serve
[size-url]: https://packagephobia.now.sh/result?p=webpack-plugin-serve
<div align="center">

@@ -20,12 +18,8 @@ <img src='https://user-images.githubusercontent.com/841294/53402609-b97a2180-39ba-11e9-8100-812bab86357c.png' height='100' alt='Apollo Server'><br/><br/>

A logging extension for the Apollo GraphQL Server
A logging plugin for Apollo GraphQL Server
<a href="https://www.patreon.com/shellscape">
<img src="https://c5.patreon.com/external/logo/become_a_patron_button@2x.png" width="160">
</a>
:heart: Please consider [Sponsoring my work](https://github.com/sponsors/shellscape)
_Please consider donating if you find this project useful._
`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:
`apollo-server` doesn't ship with any comprehensive logging, and instead offloads that responsiblity to the users and the resolvers or context handler. That can be inconvenient. This module provides uniform logging for the entire GraphQL request lifecycle, as provided by extension hooks in `apollo-server`. The console/terminal result of which will resemble the image below:
<img src="https://github.com/shellscape/apollo-log/raw/master/.github/screen.png" width="508">

@@ -37,3 +31,3 @@

This module requires an [Active LTS](https://github.com/nodejs/Release) Node version (v10.0.0+).
This module requires an [Active LTS](https://github.com/nodejs/Release) Node version (v10.23.1+).

@@ -50,12 +44,12 @@ ## Install

Setting up `apollo-log` is straight-forward. Instantiate the extension, passing any desired options, and pass the extensions array to `apollo-server`.
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`.
```js
const { ApolloLogExtension } = require('apollo-log');
const { ApolloServer } = require('apollo-server');
import { ApolloLogPlugin } from 'apollo-log';
import { ApolloServer } from 'apollo-server';
const options = { ... };
const extensions = [() => new ApolloLogExtension(options)];
const plugins = [ApolloLogPlugin(options)];
const apollo = new ApolloServer({
extensions,
plugins,
...

@@ -65,19 +59,33 @@ });

Please see the [Apollo Plugins](https://www.apollographql.com/docs/apollo-server/integrations/plugins/#installing-a-plugin) documentation for more information.
## Options
### `level`
Type: `String`<br>
Default: `info`
### `events`
Specifies at which base level that log messages will be shown (typically `info` or `debug`). For more information please see the [`loglevelnext` documentation](https://github.com/shellscape/loglevelnext/blob/master/docs/LogLevel.md#level).
Type: `Record<string, boolean>`<br>
Default: ```js
{
didEncounterErrors: true,
didResolveOperation: false,
executionDidStart: false,
parsingDidStart: false,
responseForOperation: false,
validationDidStart: false,
willSendResponse: true
}
```
Specifies which [Apollo lifecycle events](https://www.apollographql.com/docs/apollo-server/integrations/plugins/#apollo-server-event-reference) will be logged. The `requestDidStart` event is always logged, and by default `didEncounterErrors` and `willSendResponse` are logged.
### `mutate`
Type: `Function`
Default: `(level, data) => {}`
Default: `(data: Record<string, string>) => Record<string, string>`
If specified, allows inspecting and mutating the data logged to the console for each message. The `level` parameter is one of `info` or `debug`.
If specified, allows inspecting and mutating the data logged to the console for each message.
#### `prefix`
Type: `String`<br>
Default: `apollo: `
Default: `apollo`

@@ -96,1 +104,2 @@ Specifies a prefix, colored by level, prepended to each log message.

[LICENSE (Mozilla Public License)](./LICENSE)
```
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