Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove loglevel-debug and DEBUG=apollo-gateway:* support. #3896

Merged
merged 6 commits into from
Mar 18, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 0 additions & 9 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions packages/apollo-gateway/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
- Warn of a possible misconfiguration when local service configuration is provided (via `serviceList` or `localServiceList`) and a remote Apollo Graph Manager configuration is subsequently found as well. [PR #3868](https://github.com/apollographql/apollo-server/pull/3868)
- During composition, the unavailability of a downstream service in unmanaged federation mode will no longer result in a partially composed schema which merely lacks the types provided by the downed service. This prevents unexpected validation errors for clients querying a graph which lacks types which were merely unavailable during the initial composition but were intended to be part of the graph. [PR #3867](https://github.com/apollographql/apollo-server/pull/3867)
- Support providing a custom logger implementation (e.g. [`winston`](https://npm.im/winston), [`bunyan`](https://npm.im/bunyan), etc.) to capture gateway-sourced console output. This allows the use of existing, production logging facilities or the possibiltiy to use advanced structure in logging, such as console output which is encapsulated in JSON. The same PR that introduces this support also introduces a `logger` property to the `GraphQLRequestContext` that is exposed to `GraphQLDataSource`s and Apollo Server plugins, making it possible to attach additional properties (as supported by the logger implementation) to specific requests, if desired, by leveraging custom implementations in those components respectively. When not provided, these will still output to `console`. [PR #3894](https://github.com/apollographql/apollo-server/pull/3894)
- Drop use of `loglevel-debug`. This removes the very long date and time prefix in front of each log line and also the support for the `DEBUG=apollo-gateway:` environment variable. Both of these were uncommonly necessary or seldom used (with the environment variable also being undocumented). The existing behavior can be preserved by providing a `logger` that uses `loglevel-debug`, if desired, and more details can be found in the PR. [PR #3896](https://github.com/apollographql/apollo-server/pull/3896)

## 0.13.2

Expand Down
1 change: 0 additions & 1 deletion packages/apollo-gateway/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@
"apollo-server-types": "file:../apollo-server-types",
"graphql-extensions": "file:../graphql-extensions",
"loglevel": "^1.6.1",
"loglevel-debug": "^0.0.1",
"make-fetch-happen": "^7.1.1",
"pretty-format": "^24.7.0"
},
Expand Down
10 changes: 4 additions & 6 deletions packages/apollo-gateway/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@ import {
import { GraphQLSchemaValidationError } from 'apollo-graphql';
import { composeAndValidate, ServiceDefinition } from '@apollo/federation';
import loglevel from 'loglevel';
import loglevelDebug from 'loglevel-debug';

import { buildQueryPlan, buildOperationContext } from './buildQueryPlan';
import {
Expand Down Expand Up @@ -220,14 +219,13 @@ export class ApolloGateway implements GraphQLService {
this.logger = this.config.logger;
} else {
// If the user didn't provide their own logger, we'll initialize one.
const loglevelLogger = loglevel.getLogger(`apollo-gateway:`);

// Support DEBUG environment variable, à la https://npm.im/debug/.
loglevelDebug(loglevelLogger);
const loglevelLogger = loglevel.getLogger(`apollo-gateway`);

// And also support the `debug` option, if it's truthy.
if (this.config.debug === true) {
loglevelLogger.enableAll();
loglevelLogger.setLevel(loglevelLogger.levels.DEBUG);
} else {
loglevelLogger.setLevel(loglevelLogger.levels.WARN);
}

this.logger = loglevelLogger;
Expand Down
4 changes: 0 additions & 4 deletions types/loglevel-debug/index.d.ts

This file was deleted.