From 26564d28a9178b0c2cc7850b4db3c85cf352b784 Mon Sep 17 00:00:00 2001
From: clauspeterhuebner
Date: Thu, 17 Jul 2025 22:03:57 +0200
Subject: [PATCH] change logger to instance logger
---
.../src/client/1_0/AuthenticationClient.ts | 28 +++++++++----------
1 file changed, 14 insertions(+), 14 deletions(-)
diff --git a/federation/src/client/1_0/AuthenticationClient.ts b/federation/src/client/1_0/AuthenticationClient.ts
index 104d62626..aa0fa72c6 100644
--- a/federation/src/client/1_0/AuthenticationClient.ts
+++ b/federation/src/client/1_0/AuthenticationClient.ts
@@ -1,20 +1,20 @@
import { FederatedCommunity as DbFederatedCommunity } from 'database'
import { GraphQLClient } from 'graphql-request'
-import { getLogger } from 'log4js'
+import { getLogger, Logger } from 'log4js'
import { LOG4JS_BASE_CATEGORY_NAME } from '@/config/const'
import { EncryptedTransferArgs } from 'core/src/graphql/model/EncryptedTransferArgs'
import { authenticate } from './query/authenticate'
import { openConnectionCallback } from './query/openConnectionCallback'
-const logger = getLogger(`${LOG4JS_BASE_CATEGORY_NAME}.client.1_0.AuthenticationClient`)
-
export class AuthenticationClient {
dbCom: DbFederatedCommunity
endpoint: string
client: GraphQLClient
+ logger: Logger
constructor(dbCom: DbFederatedCommunity) {
+ this.logger = getLogger(`${LOG4JS_BASE_CATEGORY_NAME}.client.1_0.AuthenticationClient`)
this.dbCom = dbCom
this.endpoint = `${dbCom.endPoint.endsWith('/') ? dbCom.endPoint : dbCom.endPoint + '/'}${
dbCom.apiVersion
@@ -29,38 +29,38 @@ export class AuthenticationClient {
}
async openConnectionCallback(args: EncryptedTransferArgs): Promise {
- logger.addContext('handshakeID', args.handshakeID)
- logger.debug('openConnectionCallback with endpoint', this.endpoint, args)
+ this.logger.addContext('handshakeID', args.handshakeID)
+ this.logger.debug('openConnectionCallback with endpoint', this.endpoint, args)
try {
const { data } = await this.client.rawRequest(openConnectionCallback, { args })
- logger.debug('after openConnectionCallback: data:', data)
+ this.logger.debug('after openConnectionCallback: data:', data)
if (!data || !data.openConnectionCallback) {
- logger.warn('openConnectionCallback without response data from endpoint', this.endpoint)
+ this.logger.warn('openConnectionCallback without response data from endpoint', this.endpoint)
return false
}
- logger.debug('openConnectionCallback successfully started with endpoint', this.endpoint)
+ this.logger.debug('openConnectionCallback successfully started with endpoint', this.endpoint)
return true
} catch (err) {
- logger.error('error on openConnectionCallback', err)
+ this.logger.error('error on openConnectionCallback', err)
}
return false
}
async authenticate(args: EncryptedTransferArgs): Promise {
- logger.addContext('handshakeID', args.handshakeID)
- logger.debug('authenticate with endpoint=', this.endpoint)
+ this.logger.addContext('handshakeID', args.handshakeID)
+ this.logger.debug('authenticate with endpoint=', this.endpoint)
try {
const { data } = await this.client.rawRequest(authenticate, { args })
- logger.debug('after authenticate: data:', data)
+ this.logger.debug('after authenticate: data:', data)
const authUuid: string = data?.authenticate
if (authUuid) {
- logger.debug('received authenticated uuid', authUuid)
+ this.logger.debug('received authenticated uuid', authUuid)
return authUuid
}
} catch (err) {
- logger.error('authenticate failed', {
+ this.logger.error('authenticate failed', {
endpoint: this.endpoint,
err,
})