From ba21444d71d6004c0cdb9f489f2adbea5ca42b71 Mon Sep 17 00:00:00 2001 From: einhornimmond Date: Thu, 17 Jul 2025 08:58:10 +0200 Subject: [PATCH] change to methodLogger in federation/client/1_0/AuthenticationClient --- .../src/client/1_0/AuthenticationClient.ts | 26 ++++++++++--------- 1 file changed, 14 insertions(+), 12 deletions(-) diff --git a/federation/src/client/1_0/AuthenticationClient.ts b/federation/src/client/1_0/AuthenticationClient.ts index 104d62626..640534579 100644 --- a/federation/src/client/1_0/AuthenticationClient.ts +++ b/federation/src/client/1_0/AuthenticationClient.ts @@ -7,7 +7,7 @@ import { EncryptedTransferArgs } from 'core/src/graphql/model/EncryptedTransferA import { authenticate } from './query/authenticate' import { openConnectionCallback } from './query/openConnectionCallback' -const logger = getLogger(`${LOG4JS_BASE_CATEGORY_NAME}.client.1_0.AuthenticationClient`) +const createLogger = (method: string) => getLogger(`${LOG4JS_BASE_CATEGORY_NAME}.client.1_0.AuthenticationClient.${method}`) export class AuthenticationClient { dbCom: DbFederatedCommunity @@ -29,38 +29,40 @@ export class AuthenticationClient { } async openConnectionCallback(args: EncryptedTransferArgs): Promise { - logger.addContext('handshakeID', args.handshakeID) - logger.debug('openConnectionCallback with endpoint', this.endpoint, args) + const methodLogger = createLogger('openConnectionCallback') + methodLogger.addContext('handshakeID', args.handshakeID) + methodLogger.debug('openConnectionCallback with endpoint', this.endpoint, args) try { const { data } = await this.client.rawRequest(openConnectionCallback, { args }) - logger.debug('after openConnectionCallback: data:', data) + methodLogger.debug('after openConnectionCallback: data:', data) if (!data || !data.openConnectionCallback) { - logger.warn('openConnectionCallback without response data from endpoint', this.endpoint) + methodLogger.warn('openConnectionCallback without response data from endpoint', this.endpoint) return false } - logger.debug('openConnectionCallback successfully started with endpoint', this.endpoint) + methodLogger.debug('openConnectionCallback successfully started with endpoint', this.endpoint) return true } catch (err) { - logger.error('error on openConnectionCallback', err) + methodLogger.error('error on openConnectionCallback', err) } return false } async authenticate(args: EncryptedTransferArgs): Promise { - logger.addContext('handshakeID', args.handshakeID) - logger.debug('authenticate with endpoint=', this.endpoint) + const methodLogger = createLogger('authenticate') + methodLogger.addContext('handshakeID', args.handshakeID) + methodLogger.debug('authenticate with endpoint=', this.endpoint) try { const { data } = await this.client.rawRequest(authenticate, { args }) - logger.debug('after authenticate: data:', data) + methodLogger.debug('after authenticate: data:', data) const authUuid: string = data?.authenticate if (authUuid) { - logger.debug('received authenticated uuid', authUuid) + methodLogger.debug('received authenticated uuid', authUuid) return authUuid } } catch (err) { - logger.error('authenticate failed', { + methodLogger.error('authenticate failed', { endpoint: this.endpoint, err, })