Skip to content

Commit fee524c

Browse files
committed
dont overwrite log instances
1 parent db4b974 commit fee524c

File tree

5 files changed

+17
-12
lines changed

5 files changed

+17
-12
lines changed

packages/fusion-runtime/src/federation/supergraph.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -158,7 +158,7 @@ export const handleFederationSupergraph: UnifiedGraphHandler = function ({
158158
onDelegateHooks,
159159
additionalTypeDefs: additionalTypeDefsFromConfig = [],
160160
additionalResolvers: additionalResolversFromConfig = [],
161-
log,
161+
log: rootLog,
162162
}: UnifiedGraphHandlerOpts): UnifiedGraphHandlerResult {
163163
const additionalTypeDefs = [...asArray(additionalTypeDefsFromConfig)];
164164
const additionalResolvers = [...asArray(additionalResolversFromConfig)];
@@ -230,7 +230,7 @@ export const handleFederationSupergraph: UnifiedGraphHandler = function ({
230230
originalResolver,
231231
typeName,
232232
onDelegationStageExecuteHooks,
233-
log,
233+
rootLog,
234234
);
235235
}
236236
}
@@ -278,7 +278,7 @@ export const handleFederationSupergraph: UnifiedGraphHandler = function ({
278278
executableUnifiedGraph,
279279
// @ts-expect-error Legacy Mesh RawSource is not compatible with new Mesh
280280
subschemas,
281-
LegacyLogger.from(log),
281+
LegacyLogger.from(rootLog),
282282
onDelegateHooks || [],
283283
);
284284
const stitchingInfo = executableUnifiedGraph.extensions?.[

packages/plugins/hmac-upstream-signature/src/index.ts

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -93,8 +93,13 @@ export function useHmacUpstreamSignature(
9393
onYogaInit({ yoga }) {
9494
fetchAPI = yoga.fetchAPI;
9595
},
96-
onSubgraphExecute({ subgraphName, subgraph, executionRequest, log }) {
97-
log = log.child('[useHmacUpstreamSignature] ');
96+
onSubgraphExecute({
97+
subgraphName,
98+
subgraph,
99+
executionRequest,
100+
log: rootLog,
101+
}) {
102+
const log = rootLog.child('[useHmacUpstreamSignature] ');
98103
log.debug('Running shouldSign for subgraph %s', subgraphName);
99104

100105
if (shouldSign({ subgraphName, subgraph, executionRequest })) {

packages/runtime/src/plugins/useWebhooks.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,10 @@ export interface GatewayWebhooksPluginOptions {
99
}
1010

1111
export function useWebhooks({
12-
log,
12+
log: rootLog,
1313
pubsub,
1414
}: GatewayWebhooksPluginOptions): GatewayPlugin {
15-
log = log.child('[useWebhooks] ');
15+
const log = rootLog.child('[useWebhooks] ');
1616
if (!pubsub) {
1717
throw new Error(`You must provide a pubsub instance to webhooks feature!
1818
Example:

packages/transports/http-callback/src/index.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ export default {
7373
transportEntry,
7474
fetch,
7575
pubsub,
76-
log,
76+
log: rootLog,
7777
}): DisposableExecutor {
7878
let headersInConfig: Record<string, string> | undefined;
7979
if (typeof transportEntry.headers === 'string') {
@@ -106,7 +106,7 @@ export default {
106106
executionRequest: ExecutionRequest,
107107
) {
108108
const subscriptionId = crypto.randomUUID();
109-
log = log.child({
109+
const log = rootLog.child({
110110
executor: 'http-callback',
111111
subscription: subscriptionId,
112112
});
@@ -226,7 +226,7 @@ export default {
226226
},
227227
),
228228
(e) => {
229-
log.debug(e, `Subscription request failed`);
229+
log.error(e, 'Subscription request failed');
230230
stopSubscription(e);
231231
},
232232
);

packages/transports/ws/src/index.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ export interface WSTransportOptions {
3333

3434
export default {
3535
getSubgraphExecutor(
36-
{ transportEntry, log },
36+
{ transportEntry, log: rootLog },
3737
/**
3838
* Do not use this option unless you know what you are doing.
3939
* @internal
@@ -76,7 +76,7 @@ export default {
7676

7777
let wsExecutor = wsExecutorMap.get(hash);
7878
if (!wsExecutor) {
79-
log = log.child({
79+
const log = rootLog.child({
8080
executor: 'GraphQL WS',
8181
wsUrl,
8282
connectionParams,

0 commit comments

Comments
 (0)