You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm currently using fastify with apollo-server & apollo-gateway, I'd like to unify the loggers as there are several parts of my app that implement their own logging, I'd like to be able to pass my own logging class to the gateway to use for logging.
The text was updated successfully, but these errors were encountered:
This feature recently landed with #3894, including the possibility to access the logger provided to Apollo Server from plugins. This is currently published on the next npm tag and can be installed with npm install <package>@next for either apollo-server-* or @apollo/gateway.
Since server and gateway are (currently) instantiated separately, for the time-being, it will still be necessary to pass the logger to both ApolloServer and ApolloGateway during their setup. The one made available to Apollo Server will be on the request context, for both RemoteGraphQLDataSources and for plugins. The logger passed to ApolloGateway will be used for non-request specific logging. Roughly, though I haven't tested this, it should work as such:
constlogger=console;// Needs `debug`, `info`, `warn` and `error`.constgateway=newApolloGateway({
logger,});constserver=newApolloServer({logger,
gateway,plugins: [requestDidStart({ logger }){logger.warn("Your own message from your own plugin!");}],});
I'm currently using fastify with apollo-server & apollo-gateway, I'd like to unify the loggers as there are several parts of my app that implement their own logging, I'd like to be able to pass my own logging class to the gateway to use for logging.
The text was updated successfully, but these errors were encountered: