-
Notifications
You must be signed in to change notification settings - Fork 2k
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
Apollo Server 2: Remove formatParams #1331
Conversation
docs/source/features/metrics.md
Outdated
@@ -40,16 +40,12 @@ Apollo Server provides two ways to log a server: per input, response, and errors | |||
|
|||
### High Level Logging | |||
|
|||
To log the inputs, response, and request, Apollo Server provides three methods: `formatParams`, `formatError`, and `formatResponse`. This example uses `console.log` to record the information, servers can use other more sophisticated tools. | |||
To log the inputs, response, and request, Apollo Server provides three methods: `formatError` and `formatResponse`. This example uses `console.log` to record the information, servers can use other more sophisticated tools. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We no longer have three methods, and no way to log the inputs with a simple callback.
docs/source/migration-two-dot.md
Outdated
For most other functions that might have required access to the middleware arguments, such as `formatParams`, `formatError`, and `formatResponse`, it is possible to create a `graphql-extension`. | ||
|
||
For more complicated use cases, the `ApolloServer` class can be extended to override the `createGraphQLServerOptions` function to create parameters based on the same argument that's passed to the context. | ||
|
||
<h2 id="log-function">Replacing `logFunction`</h2> | ||
|
||
Apollo Server 2 removes the `logFunction` in favor of using `graphql-extensions`, which provides a more structured and flexible way of instrumenting Apollo Server. The explanation of how to do this more granular logging, can be found in the [metrics section](./features/metrics.html) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We should probably note that extensions are not a public API yet at this point.
This removes
formatParams
, because it is an internal implementation detail of the new Apollo Server as opposed to a first class functionality as in the middleware. It was originally used to implement a form of persisted queries, which is now unnecessary.In the future, we are planning to move to a more extensible request pathway inside of Apollo Server that should provide the functionality that was originally provided by
formatParams
. If you are dependent on the behavior offormatParams
, please open an issue and we can continue discussions there. In the meantime, the release candidate(rc.7) provides a stop-gap measure.