Skip to content
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
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@makerx/graphql-apollo-server",
"version": "1.5.1",
"version": "1.6.0",
"private": false,
"description": "A set of MakerX plugins for Apollo Server",
"author": "MakerX",
Expand Down
10 changes: 9 additions & 1 deletion src/plugins/graphql-operation-logging-plugin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,10 @@
* Can be used to augment the log entry with additional properties
*/
augmentLogEntry?: (ctx: TContext) => Record<string, any>
/**
* Can be used to resolve a custom logger for the plugin
*/
resolveCustomLogger?: (context: TContext) => TLogger
}

/**
Expand All @@ -68,6 +72,7 @@
adjustVariables,
adjustResultData,
augmentLogEntry,
resolveCustomLogger,
}: GraphQLOperationLoggingPluginOptions<TContext, TLogger> = {}): ApolloServerPlugin<TContext> {
return {
contextCreationDidFail: async ({ error }) => {
Expand All @@ -80,7 +85,10 @@
ctx: GraphQLRequestContextWillSendResponse<TContext>,
subsequentPayload?: GraphQLExperimentalFormattedSubsequentIncrementalExecutionResult,
) {
const { started, logger } = contextValue
const { started } = contextValue
const { logger } = resolveCustomLogger

Check warning on line 89 in src/plugins/graphql-operation-logging-plugin.ts

View workflow job for this annotation

GitHub Actions / pull_request / node-ci

Replace `⏎··········?·{·logger:·resolveCustomLogger(contextValue)·}⏎·········` with `·?·{·logger:·resolveCustomLogger(contextValue)·}`
? { logger: resolveCustomLogger(contextValue) }
: contextValue
const { operationName, query, variables } = ctx.request
const isIntrospection = query && isIntrospectionQuery(query)
if (isIntrospection && ignoreIntrospectionQueries) return
Expand Down