Open
Description
Apollo server has a logger
option that you can set to determine the logger it should use.
Azure Functions provide the logger via the context object such that your logger logs to App Insights.
However, this integration needs you to initialize and pass in the server object before you can access the context.
Is there any way to set Apollo's logger to the logger from Azure context?
const server = new ApolloServer<MyApiContext>({
typeDefs,
resolvers,
formatError: (formattedError: GraphQLFormattedError): GraphQLFormattedError => {
context.log.error({
error: formattedError.message,
locations: formattedError.locations,
path: formattedError.path,
extensions: formattedError.extensions,
});
return formattedError;
},
includeStacktraceInErrorResponses: NODE_ENV === 'development',
logger: ???
});
const azureFunction = startServerAndCreateHandler(server, {
context: async ({ req, context: { log } }): Promise<MyApiContext> => {
...
},
});
Metadata
Metadata
Assignees
Labels
No labels