File tree Expand file tree Collapse file tree 2 files changed +10
-2
lines changed
Expand file tree Collapse file tree 2 files changed +10
-2
lines changed Original file line number Diff line number Diff line change 11{
22 "name" : " @makerx/graphql-apollo-server" ,
3- "version" : " 1.5.1 " ,
3+ "version" : " 1.6.0 " ,
44 "private" : false ,
55 "description" : " A set of MakerX plugins for Apollo Server" ,
66 "author" : " MakerX" ,
Original file line number Diff line number Diff line change @@ -51,6 +51,10 @@ export interface GraphQLOperationLoggingPluginOptions<TContext extends GraphQLCo
5151 * Can be used to augment the log entry with additional properties
5252 */
5353 augmentLogEntry ?: ( ctx : TContext ) => Record < string , any >
54+ /**
55+ * Can be used to resolve a custom logger for the plugin
56+ */
57+ resolveCustomLogger ?: ( context : TContext ) => TLogger
5458}
5559
5660/**
@@ -68,6 +72,7 @@ export function graphqlOperationLoggingPlugin<TContext extends GraphQLContext<TL
6872 adjustVariables,
6973 adjustResultData,
7074 augmentLogEntry,
75+ resolveCustomLogger,
7176} : GraphQLOperationLoggingPluginOptions < TContext , TLogger > = { } ) : ApolloServerPlugin < TContext > {
7277 return {
7378 contextCreationDidFail : async ( { error } ) => {
@@ -80,7 +85,10 @@ export function graphqlOperationLoggingPlugin<TContext extends GraphQLContext<TL
8085 ctx : GraphQLRequestContextWillSendResponse < TContext > ,
8186 subsequentPayload ?: GraphQLExperimentalFormattedSubsequentIncrementalExecutionResult ,
8287 ) {
83- const { started, logger } = contextValue
88+ const { started } = contextValue
89+ const { logger } = resolveCustomLogger
90+ ? { logger : resolveCustomLogger ( contextValue ) }
91+ : contextValue
8492 const { operationName, query, variables } = ctx . request
8593 const isIntrospection = query && isIntrospectionQuery ( query )
8694 if ( isIntrospection && ignoreIntrospectionQueries ) return
You can’t perform that action at this time.
0 commit comments