Ensuring Actions can be Recreated

Apollo Server provides two ways to log a server: by input,response, and errors or periodically throughout a request’s lifecycle. Treating the GraphQL execution as a black box by logging the inputs and outputs of the system allows developers to diagnose issues quickly without being mired by lower level logs. Once a problem has been found at a high level, the lower level logs enable accurate tracing of how a request was handled.

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.

const server = new ApolloServer({
  formatParams: params => {
    return params;
  formatError: error => {
    return error;
  formatResponse: response => {
    return response;

server.listen().then(({ url }) => {
  console.log(`🚀  Server ready at ${url}`);
Edit on GitHub
// search box