Merge branch 'upgrade_logging' into refactor_shared_module

This commit is contained in:
einhornimmond 2025-06-26 07:46:09 +02:00
commit 84862bce8b
79 changed files with 121 additions and 187 deletions

View File

@ -1,10 +1,10 @@
import axios from 'axios'
import { LOG4JS_APIS_CATEGORY_NAME } from '@/apis'
import { LOG4JS_BASE_CATEGORY_NAME } from '@/config/const'
import { LogError } from '@/server/LogError'
import { getLogger } from 'log4js'
const logger = getLogger(`${LOG4JS_APIS_CATEGORY_NAME}.HttpRequest`)
const logger = getLogger(`${LOG4JS_BASE_CATEGORY_NAME}.apis.HttpRequest`)
import { httpAgent, httpsAgent } from './ConnectionAgents'

View File

@ -1,10 +1,10 @@
import { LOG4JS_APIS_CATEGORY_NAME } from '@/apis'
import { LOG4JS_BASE_CATEGORY_NAME } from '@/config/const'
import { CONFIG } from '@/config'
import KlicktippConnector from 'klicktipp-api'
import { getLogger } from 'log4js'
const klicktippConnector = new KlicktippConnector()
const logger = getLogger(`${LOG4JS_APIS_CATEGORY_NAME}.KlicktippController`)
const logger = getLogger(`${LOG4JS_BASE_CATEGORY_NAME}.apis.KlicktippController`)
export const subscribe = async (
email: string,

View File

@ -1,8 +1,8 @@
import { Transaction as DbTransaction } from 'database'
import { GraphQLClient, gql } from 'graphql-request'
import { LOG4JS_APIS_CATEGORY_NAME } from '@/apis/index'
import { CONFIG } from '@/config'
import { LOG4JS_BASE_CATEGORY_NAME } from '@/config/const'
import { TransactionTypeId } from '@/graphql/enum/TransactionTypeId'
import { LogError } from '@/server/LogError'
import { getLogger } from 'log4js'
@ -10,7 +10,7 @@ import { getLogger } from 'log4js'
import { TransactionResult } from './model/TransactionResult'
import { UserIdentifier } from './model/UserIdentifier'
const logger = getLogger(`${LOG4JS_APIS_CATEGORY_NAME}.dltConnector`)
const logger = getLogger(`${LOG4JS_BASE_CATEGORY_NAME}.apis.dltConnector`)
const sendTransaction = gql`
mutation ($input: TransactionInput!) {

View File

@ -1,7 +1,7 @@
import { User as DbUser } from 'database'
// import { createTestClient } from 'apollo-server-testing'
import { LOG4JS_GMS_CATEGORY_NAME } from '@/apis/gms/index'
import { LOG4JS_BASE_CATEGORY_NAME } from '@/config/const'
// import { createGmsUser } from '@/apis/gms/GmsClient'
// import { GmsUser } from '@/apis/gms/model/GmsUser'
import { CONFIG } from '@/config'
@ -11,7 +11,7 @@ import { initLogging } from '@/server/logger'
import { AppDatabase, getHomeCommunity } from 'database'
import { getLogger } from 'log4js'
const logger = getLogger(`${LOG4JS_GMS_CATEGORY_NAME}.ExportUsers`)
const logger = getLogger(`${LOG4JS_BASE_CATEGORY_NAME}.apis.gms.ExportUsers`)
CONFIG.EMAIL = false
// use force to copy over all user even if gmsRegistered is set to true

View File

@ -1,7 +1,7 @@
import axios from 'axios'
import { httpAgent, httpsAgent } from '@/apis/ConnectionAgents'
import { LOG4JS_GMS_CATEGORY_NAME } from '@/apis/gms/index'
import { LOG4JS_BASE_CATEGORY_NAME } from '@/config/const'
import { CONFIG } from '@/config'
import { LogError } from '@/server/LogError'
import { ensureUrlEndsWithSlash } from '@/util/utilities'
@ -9,7 +9,7 @@ import { getLogger } from 'log4js'
import { GmsUser } from './model/GmsUser'
const logger = getLogger(`${LOG4JS_GMS_CATEGORY_NAME}.GmsClient`)
const logger = getLogger(`${LOG4JS_BASE_CATEGORY_NAME}.apis.gms.GmsClient`)
/*
export async function communityList(): Promise<GmsCommunity[] | string | undefined> {

View File

@ -1,3 +0,0 @@
import { LOG4JS_APIS_CATEGORY_NAME } from '@/apis'
export const LOG4JS_GMS_CATEGORY_NAME = `${LOG4JS_APIS_CATEGORY_NAME}.gms`

View File

@ -1,7 +1,7 @@
import { AppDatabase, User } from 'database'
import { IsNull, Not } from 'typeorm'
import { LOG4JS_HUMHUB_CATEGORY_NAME } from '@/apis/humhub/index'
import { LOG4JS_BASE_CATEGORY_NAME } from '@/config/const'
import { initLogging } from '@/server/logger'
import { getLogger } from 'log4js'
import { HumHubClient } from './HumHubClient'
@ -11,7 +11,7 @@ import { ExecutedHumhubAction, syncUser } from './syncUser'
const USER_BULK_SIZE = 20
const HUMHUB_BULK_SIZE = 50
const logger = getLogger(`${LOG4JS_HUMHUB_CATEGORY_NAME}.ExportUsers`)
const logger = getLogger(`${LOG4JS_BASE_CATEGORY_NAME}.apis.humhub.ExportUsers`)
function getUsersPage(page: number, limit: number): Promise<[User[], number]> {
return User.findAndCount({

View File

@ -5,7 +5,7 @@ import { IRequestOptions, IRestResponse, RestClient } from 'typed-rest-client'
import { CONFIG } from '@/config'
import { LogError } from '@/server/LogError'
import { LOG4JS_HUMHUB_CATEGORY_NAME } from '@/apis/humhub/index'
import { LOG4JS_BASE_CATEGORY_NAME } from '@/config/const'
import { getLogger } from 'log4js'
import { PostUserLoggingView } from './logging/PostUserLogging.view'
import { GetUser } from './model/GetUser'
@ -14,7 +14,7 @@ import { Space } from './model/Space'
import { SpacesResponse } from './model/SpacesResponse'
import { UsersResponse } from './model/UsersResponse'
const logger = getLogger(`${LOG4JS_HUMHUB_CATEGORY_NAME}.HumHubClient`)
const logger = getLogger(`${LOG4JS_BASE_CATEGORY_NAME}.apis.humhub.HumHubClient`)
/**
* HumHubClient as singleton class

View File

@ -1,3 +0,0 @@
import { LOG4JS_APIS_CATEGORY_NAME } from '@/apis'
export const LOG4JS_HUMHUB_CATEGORY_NAME = `${LOG4JS_APIS_CATEGORY_NAME}.humhub`

View File

@ -1,6 +1,6 @@
import { User } from 'database'
import { LOG4JS_HUMHUB_CATEGORY_NAME } from '@/apis/humhub/index'
import { LOG4JS_BASE_CATEGORY_NAME } from '@/config/const'
import { LogError } from '@/server/LogError'
import { getLogger } from 'log4js'
@ -9,7 +9,7 @@ import { isHumhubUserIdenticalToDbUser } from './compareHumhubUserDbUser'
import { GetUser } from './model/GetUser'
import { PostUser } from './model/PostUser'
const logger = getLogger(`${LOG4JS_HUMHUB_CATEGORY_NAME}.syncUser`)
const logger = getLogger(`${LOG4JS_BASE_CATEGORY_NAME}.apis.humhub.syncUser`)
export enum ExecutedHumhubAction {
UPDATE,

View File

@ -1,3 +0,0 @@
import { LOG4JS_BASE_CATEGORY_NAME } from '@/config/const'
export const LOG4JS_APIS_CATEGORY_NAME = `${LOG4JS_BASE_CATEGORY_NAME}.apis`

View File

@ -7,10 +7,10 @@ import { CONFIG } from '@/config'
import { Message as MessageModel } from './model/Message'
import { LOG4JS_APIS_CATEGORY_NAME } from '@/apis'
import { LOG4JS_BASE_CATEGORY_NAME } from '@/config/const'
import { getLogger } from 'log4js'
const logger = getLogger(`${LOG4JS_APIS_CATEGORY_NAME}.openai.OpenaiClient`)
const logger = getLogger(`${LOG4JS_BASE_CATEGORY_NAME}.apis.openai.OpenaiClient`)
/**
* The `OpenaiClient` class is a singleton that provides an interface to interact with the OpenAI API.

View File

@ -1,3 +0,0 @@
import { LOG4JS_BASE_CATEGORY_NAME } from '@/config/const'
export const LOG4JS_EMAILS_CATEGORY_NAME = `${LOG4JS_BASE_CATEGORY_NAME}.emails`

View File

@ -5,10 +5,10 @@ import { i18n } from '@test/testSetup'
import { CONFIG } from '@/config'
import { getLogger } from 'config-schema/test/testSetup'
import { LOG4JS_EMAILS_CATEGORY_NAME } from '.'
import { LOG4JS_BASE_CATEGORY_NAME } from '@/config/const'
import { sendEmailTranslated } from './sendEmailTranslated'
const logger = getLogger(`${LOG4JS_EMAILS_CATEGORY_NAME}.sendEmailTranslated`)
const logger = getLogger(`${LOG4JS_BASE_CATEGORY_NAME}.emails.sendEmailTranslated`)
const testMailServerHost = 'localhost'
const testMailServerPort = 1025

View File

@ -5,10 +5,10 @@ import i18n from 'i18n'
import { createTransport } from 'nodemailer'
import { CONFIG } from '@/config'
import { LOG4JS_EMAILS_CATEGORY_NAME } from '@/emails'
import { LOG4JS_BASE_CATEGORY_NAME } from '@/config/const'
import { getLogger } from 'log4js'
const logger = getLogger(`${LOG4JS_EMAILS_CATEGORY_NAME}.sendEmailTranslated`)
const logger = getLogger(`${LOG4JS_BASE_CATEGORY_NAME}.emails.sendEmailTranslated`)
export const sendEmailTranslated = async ({
receiver,

View File

@ -5,9 +5,6 @@ import { DataSource } from 'typeorm'
import { testEnvironment } from '@test/helpers'
import { i18n as localization } from '@test/testSetup'
import { getLogger } from 'config-schema/test/testSetup'
import { LOG4JS_EMAILS_CATEGORY_NAME } from '.'
const logger = getLogger(`${LOG4JS_EMAILS_CATEGORY_NAME}.sendEmailTranslated`)
import { CONFIG } from '@/config'
@ -57,7 +54,7 @@ let testEnv: {
}
beforeAll(async () => {
testEnv = await testEnvironment(logger, localization)
testEnv = await testEnvironment(getLogger('apollo'), localization)
con = testEnv.con
})

View File

@ -6,12 +6,12 @@ import { CONFIG } from '@/config'
import { AuthenticationClient as V1_0_AuthenticationClient } from '@/federation/client/1_0/AuthenticationClient'
import { ensureUrlEndsWithSlash } from '@/util/utilities'
import { LOG4JS_FEDERATION_CATEGORY_NAME } from '@/federation'
import { getLogger } from 'log4js'
import { OpenConnectionArgs } from './client/1_0/model/OpenConnectionArgs'
import { AuthenticationClientFactory } from './client/AuthenticationClientFactory'
import { LOG4JS_BASE_CATEGORY_NAME } from '@/config/const'
const logger = getLogger(`${LOG4JS_FEDERATION_CATEGORY_NAME}.authenticateCommunities`)
const logger = getLogger(`${LOG4JS_BASE_CATEGORY_NAME}.federation.authenticateCommunities`)
export async function startCommunityAuthentication(
foreignFedCom: DbFederatedCommunity,

View File

@ -3,12 +3,12 @@ import { GraphQLClient } from 'graphql-request'
import { ensureUrlEndsWithSlash } from '@/util/utilities'
import { LOG4JS_FEDERATION_CLIENT1_0_CATEGORY_NAME } from '@/federation/client/1_0'
import { LOG4JS_BASE_CATEGORY_NAME } from '@/config/const'
import { getLogger } from 'log4js'
import { OpenConnectionArgs } from './model/OpenConnectionArgs'
import { openConnection } from './query/openConnection'
const logger = getLogger(`${LOG4JS_FEDERATION_CLIENT1_0_CATEGORY_NAME}.AuthenticationClient`)
const logger = getLogger(`${LOG4JS_BASE_CATEGORY_NAME}.federation.client.1_0.AuthenticationClient`)
export class AuthenticationClient {
dbCom: DbFederatedCommunity

View File

@ -1,7 +1,7 @@
import { FederatedCommunity as DbFederatedCommunity } from 'database'
import { GraphQLClient } from 'graphql-request'
import { LOG4JS_FEDERATION_CLIENT1_0_CATEGORY_NAME } from '@/federation/client/1_0'
import { LOG4JS_BASE_CATEGORY_NAME } from '@/config/const'
import { getPublicCommunityInfo } from '@/federation/client/1_0/query/getPublicCommunityInfo'
import { getPublicKey } from '@/federation/client/1_0/query/getPublicKey'
import { ensureUrlEndsWithSlash } from '@/util/utilities'
@ -11,7 +11,7 @@ import { PublicCommunityInfoLoggingView } from './logging/PublicCommunityInfoLog
import { GetPublicKeyResult } from './model/GetPublicKeyResult'
import { PublicCommunityInfo } from './model/PublicCommunityInfo'
const logger = getLogger(`${LOG4JS_FEDERATION_CLIENT1_0_CATEGORY_NAME}.FederationClient`)
const logger = getLogger(`${LOG4JS_BASE_CATEGORY_NAME}.federation.client.1_0.FederationClient`)
export class FederationClient {
dbCom: DbFederatedCommunity

View File

@ -5,7 +5,7 @@ import { LogError } from '@/server/LogError'
import { ensureUrlEndsWithSlash } from '@/util/utilities'
import { getLogger } from 'log4js'
import { LOG4JS_FEDERATION_CLIENT1_0_CATEGORY_NAME } from '.'
import { LOG4JS_BASE_CATEGORY_NAME } from '@/config/const'
import { SendCoinsArgsLoggingView } from './logging/SendCoinsArgsLogging.view'
import { SendCoinsResultLoggingView } from './logging/SendCoinsResultLogging.view'
import { SendCoinsArgs } from './model/SendCoinsArgs'
@ -15,7 +15,7 @@ import { revertSettledSendCoins as revertSettledSendCoinsQuery } from './query/r
import { settleSendCoins as settleSendCoinsQuery } from './query/settleSendCoins'
import { voteForSendCoins as voteForSendCoinsQuery } from './query/voteForSendCoins'
const logger = getLogger(`${LOG4JS_FEDERATION_CLIENT1_0_CATEGORY_NAME}.SendCoinsClient`)
const logger = getLogger(`${LOG4JS_BASE_CATEGORY_NAME}.federation.client.1_0.SendCoinsClient`)
export class SendCoinsClient {
dbCom: DbFederatedCommunity

View File

@ -1,3 +0,0 @@
import { LOG4JS_FEDERATION_CATEGORY_NAME } from '@/federation'
export const LOG4JS_FEDERATION_CLIENT1_0_CATEGORY_NAME = `${LOG4JS_FEDERATION_CATEGORY_NAME}.client.1_0`

View File

@ -1,3 +0,0 @@
import { LOG4JS_BASE_CATEGORY_NAME } from '@/config/const'
export const LOG4JS_FEDERATION_CATEGORY_NAME = `${LOG4JS_BASE_CATEGORY_NAME}.federation`

View File

@ -4,16 +4,15 @@ import { GraphQLClient } from 'graphql-request'
import { Response } from 'graphql-request/dist/types'
import { DataSource, Not } from 'typeorm'
import { LOG4JS_FEDERATION_CATEGORY_NAME } from '@/federation'
import { LOG4JS_FEDERATION_CLIENT1_0_CATEGORY_NAME } from '@/federation/client/1_0'
import { cleanDB, testEnvironment } from '@test/helpers'
import { getLogger } from 'config-schema/test/testSetup'
import { LOG4JS_BASE_CATEGORY_NAME } from '@/config/const'
import { validateCommunities } from './validateCommunities'
const logger = getLogger(`${LOG4JS_FEDERATION_CATEGORY_NAME}.validateCommunities`)
const logger = getLogger(`${LOG4JS_BASE_CATEGORY_NAME}.federation.validateCommunities`)
const federationClientLogger = getLogger(
`${LOG4JS_FEDERATION_CLIENT1_0_CATEGORY_NAME}.FederationClient`,
`${LOG4JS_BASE_CATEGORY_NAME}.federation.client.1_0.FederationClient`,
)
let con: DataSource

View File

@ -5,7 +5,6 @@ import {
} from 'database'
import { IsNull } from 'typeorm'
import { LOG4JS_FEDERATION_CATEGORY_NAME } from '@/federation'
import { FederationClient as V1_0_FederationClient } from '@/federation/client/1_0/FederationClient'
import { PublicCommunityInfo } from '@/federation/client/1_0/model/PublicCommunityInfo'
import { FederationClientFactory } from '@/federation/client/FederationClientFactory'
@ -14,8 +13,9 @@ import { getLogger } from 'log4js'
import { startCommunityAuthentication } from './authenticateCommunities'
import { PublicCommunityInfoLoggingView } from './client/1_0/logging/PublicCommunityInfoLogging.view'
import { ApiVersionType } from './enum/apiVersionType'
import { LOG4JS_BASE_CATEGORY_NAME } from '@/config/const'
const logger = getLogger(`${LOG4JS_FEDERATION_CATEGORY_NAME}.validateCommunities`)
const logger = getLogger(`${LOG4JS_BASE_CATEGORY_NAME}.federation.validateCommunities`)
export async function startValidateCommunities(timerInterval: number): Promise<void> {
if (Number.isNaN(timerInterval) || timerInterval <= 0) {

View File

@ -12,7 +12,7 @@ import { Context, getUser } from '@/server/context'
import { calculateDecay } from 'shared'
import { getLogger } from 'log4js'
import { LOG4JS_RESOLVER_CATEGORY_NAME } from '.'
import { LOG4JS_BASE_CATEGORY_NAME } from '@/config/const'
import { GdtResolver } from './GdtResolver'
import { getLastTransaction } from './util/getLastTransaction'
import { transactionLinkSummary } from './util/transactionLinkSummary'
@ -24,7 +24,7 @@ export class BalanceResolver {
async balance(@Ctx() context: Context): Promise<Balance> {
const user = getUser(context)
const now = new Date()
const logger = getLogger(`${LOG4JS_RESOLVER_CATEGORY_NAME}.BalanceResolver`)
const logger = getLogger(`${LOG4JS_BASE_CATEGORY_NAME}.graphql.resolver.BalanceResolver`)
logger.addContext('user', user.id)
logger.info(`balance...`)

View File

@ -19,12 +19,10 @@ import {
import { peterLustig } from '@/seeds/users/peter-lustig'
import { getLogger } from 'config-schema/test/testSetup'
import { LOG4JS_RESOLVER_CATEGORY_NAME } from '.'
import { getCommunityByUuid } from './util/communities'
jest.mock('@/password/EncryptorUtils')
const logger = getLogger(`${LOG4JS_RESOLVER_CATEGORY_NAME}.CommunityResolver`)
// to do: We need a setup for the tests that closes the connection
let mutate: ApolloServerTestClient['mutate']
@ -44,7 +42,7 @@ const peterLoginData = {
}
beforeAll(async () => {
testEnv = await testEnvironment(logger, localization)
testEnv = await testEnvironment(getLogger('apollo'), localization)
mutate = testEnv.mutate
query = testEnv.query
con = testEnv.con

View File

@ -10,7 +10,6 @@ import { i18n as localization } from '@test/testSetup'
import { LOG4JS_BASE_CATEGORY_NAME } from '@/config/const'
import { sendAddedContributionMessageEmail } from '@/emails/sendEmailVariants'
import { EventType } from '@/event/Events'
import { LOG4JS_INTERACTION_CATEGORY_NAME } from '@/interactions'
import { userFactory } from '@/seeds/factory/user'
import {
adminCreateContributionMessage,
@ -22,13 +21,12 @@ import { adminListContributionMessages, listContributionMessages } from '@/seeds
import { bibiBloxberg } from '@/seeds/users/bibi-bloxberg'
import { bobBaumeister } from '@/seeds/users/bob-baumeister'
import { peterLustig } from '@/seeds/users/peter-lustig'
import { clearLogs, getLogger, printLogs } from 'config-schema/test/testSetup'
import { LOG4JS_RESOLVER_CATEGORY_NAME } from '.'
import { getLogger} from 'config-schema/test/testSetup'
const logger = getLogger(`${LOG4JS_RESOLVER_CATEGORY_NAME}.ContributionMessageResolver`)
const logger = getLogger(`${LOG4JS_BASE_CATEGORY_NAME}.graphql.resolver.ContributionMessageResolver`)
const logErrorLogger = getLogger(`${LOG4JS_BASE_CATEGORY_NAME}.server.LogError`)
const interactionLogger = getLogger(
`${LOG4JS_INTERACTION_CATEGORY_NAME}.updateUnconfirmedContribution`,
`${LOG4JS_BASE_CATEGORY_NAME}.interactions.updateUnconfirmedContribution`,
)
jest.mock('@/password/EncryptorUtils')

View File

@ -23,13 +23,13 @@ import { UpdateUnconfirmedContributionContext } from '@/interactions/updateUncon
import { LogError } from '@/server/LogError'
import { Context, getUser } from '@/server/context'
import { getLogger } from 'log4js'
import { LOG4JS_RESOLVER_CATEGORY_NAME } from '.'
import { LOG4JS_BASE_CATEGORY_NAME } from '@/config/const'
import { contributionFrontendLink } from './util/contributions'
import { findContributionMessages } from './util/findContributionMessages'
const db = AppDatabase.getInstance()
const createLogger = () => getLogger(`${LOG4JS_RESOLVER_CATEGORY_NAME}.ContributionMessageResolver`)
const createLogger = () => getLogger(`${LOG4JS_BASE_CATEGORY_NAME}.graphql.resolver.ContributionMessageResolver`)
@Resolver()
export class ContributionMessageResolver {

View File

@ -51,7 +51,7 @@ import { peterLustig } from '@/seeds/users/peter-lustig'
import { raeuberHotzenplotz } from '@/seeds/users/raeuber-hotzenplotz'
import { stephenHawking } from '@/seeds/users/stephen-hawking'
import { getFirstDayOfPreviousNMonth } from '@/util/utilities'
import { clearLogs, getLogger, printLogs } from 'config-schema/test/testSetup'
import { getLogger } from 'config-schema/test/testSetup'
import { getLogger as originalGetLogger } from 'log4js'
jest.mock('@/emails/sendEmailVariants')

View File

@ -46,7 +46,7 @@ import { TRANSACTIONS_LOCK } from '@/util/TRANSACTIONS_LOCK'
import { calculateDecay, Decay } from 'shared'
import { fullName } from '@/util/utilities'
import { LOG4JS_RESOLVER_CATEGORY_NAME } from '@/graphql/resolver'
import { LOG4JS_BASE_CATEGORY_NAME } from '@/config/const'
import { ContributionMessageType } from '@enum/ContributionMessageType'
import { AppDatabase } from 'database'
import { getLogger } from 'log4js'
@ -62,7 +62,7 @@ import { getLastTransaction } from './util/getLastTransaction'
import { sendTransactionsToDltConnector } from './util/sendTransactionsToDltConnector'
const db = AppDatabase.getInstance()
const createLogger = () => getLogger(`${LOG4JS_RESOLVER_CATEGORY_NAME}.ContributionResolver`)
const createLogger = () => getLogger(`${LOG4JS_BASE_CATEGORY_NAME}.graphql.resolver.ContributionResolver`)
@Resolver(() => Contribution)
export class ContributionResolver {

View File

@ -11,9 +11,9 @@ import { CONFIG } from '@/config'
import { LogError } from '@/server/LogError'
import { Context, getUser } from '@/server/context'
import { getLogger } from 'log4js'
import { LOG4JS_RESOLVER_CATEGORY_NAME } from '.'
import { LOG4JS_BASE_CATEGORY_NAME } from '@/config/const'
const logger = getLogger(`${LOG4JS_RESOLVER_CATEGORY_NAME}.GdtResolver`)
const logger = getLogger(`${LOG4JS_BASE_CATEGORY_NAME}.graphql.resolver.GdtResolver`)
@Resolver()
export class GdtResolver {

View File

@ -9,11 +9,11 @@ import { EventType } from '@/event/Events'
import { userFactory } from '@/seeds/factory/user'
import { login, subscribeNewsletter, unsubscribeNewsletter } from '@/seeds/graphql/mutations'
import { bibiBloxberg } from '@/seeds/users/bibi-bloxberg'
import { LOG4JS_RESOLVER_CATEGORY_NAME } from '.'
import { LOG4JS_BASE_CATEGORY_NAME } from '@/config/const'
jest.mock('@/password/EncryptorUtils')
const logger = getLogger(`${LOG4JS_RESOLVER_CATEGORY_NAME}.KlicktippResolver`)
const logger = getLogger(`${LOG4JS_BASE_CATEGORY_NAME}.graphql.resolver.KlicktippResolver`)
let testEnv: any
let mutate: any

View File

@ -10,9 +10,9 @@ import { HumHubClient } from '@/apis/humhub/HumHubClient'
import { RIGHTS } from '@/auth/RIGHTS'
import { LogError } from '@/server/LogError'
import { getLogger } from 'log4js'
import { LOG4JS_RESOLVER_CATEGORY_NAME } from '.'
import { LOG4JS_BASE_CATEGORY_NAME } from '@/config/const'
const logger = getLogger(`${LOG4JS_RESOLVER_CATEGORY_NAME}.ProjectBrandingResolver`)
const logger = getLogger(`${LOG4JS_BASE_CATEGORY_NAME}.graphql.resolver.ProjectBrandingResolver`)
@Resolver(() => ProjectBranding)
export class ProjectBrandingResolver {

View File

@ -45,7 +45,7 @@ import { calculateBalance } from '@/util/validate'
import { DisburseJwtPayloadType } from '@/auth/jwt/payloadtypes/DisburseJwtPayloadType'
import { Logger, getLogger } from 'log4js'
import { LOG4JS_RESOLVER_CATEGORY_NAME } from '.'
import { LOG4JS_BASE_CATEGORY_NAME } from '@/config/const'
import { executeTransaction } from './TransactionResolver'
import {
getAuthenticatedCommunities,
@ -56,7 +56,7 @@ import { getLastTransaction } from './util/getLastTransaction'
import { sendTransactionsToDltConnector } from './util/sendTransactionsToDltConnector'
import { transactionLinkList } from './util/transactionLinkList'
const createLogger = () => getLogger(`${LOG4JS_RESOLVER_CATEGORY_NAME}.TransactionLinkResolver`)
const createLogger = () => getLogger(`${LOG4JS_BASE_CATEGORY_NAME}.graphql.resolver.TransactionLinkResolver`)
// TODO: do not export, test it inside the resolver
export const transactionLinkCode = (date: Date): string => {

View File

@ -37,7 +37,7 @@ import { calculateBalance } from '@/util/validate'
import { virtualDecayTransaction, virtualLinkTransaction } from '@/util/virtualTransactions'
import { Logger, getLogger } from 'log4js'
import { LOG4JS_RESOLVER_CATEGORY_NAME } from '.'
import { LOG4JS_BASE_CATEGORY_NAME } from '@/config/const'
import { BalanceResolver } from './BalanceResolver'
import { GdtResolver } from './GdtResolver'
import { getCommunityByIdentifier, getCommunityName, isHomeCommunity } from './util/communities'
@ -52,7 +52,7 @@ import { storeForeignUser } from './util/storeForeignUser'
import { transactionLinkSummary } from './util/transactionLinkSummary'
const db = AppDatabase.getInstance()
const createLogger = () => getLogger(`${LOG4JS_RESOLVER_CATEGORY_NAME}.TransactionResolver`)
const createLogger = () => getLogger(`${LOG4JS_BASE_CATEGORY_NAME}.graphql.resolver.TransactionResolver`)
export const executeTransaction = async (
amount: Decimal,

View File

@ -69,7 +69,6 @@ import { objectValuesToArray } from '@/util/utilities'
import { LOG4JS_BASE_CATEGORY_NAME } from '@/config/const'
import { getLogger } from 'config-schema/test/testSetup'
import { LOG4JS_RESOLVER_CATEGORY_NAME } from '.'
import { Location2Point } from './util/Location2Point'
jest.mock('@/apis/humhub/HumHubClient')
@ -96,7 +95,7 @@ jest.mock('@/apis/KlicktippController', () => {
}
})
const logger = getLogger(`${LOG4JS_RESOLVER_CATEGORY_NAME}.UserResolver`)
const logger = getLogger(`${LOG4JS_BASE_CATEGORY_NAME}.graphql.resolver.UserResolver`)
const logErrorLogger = getLogger(`${LOG4JS_BASE_CATEGORY_NAME}.server.LogError`)
CONFIG.EMAIL_CODE_REQUEST_TIME = 10
@ -113,7 +112,7 @@ let testEnv: {
}
beforeAll(async () => {
testEnv = await testEnvironment(logger, localization)
testEnv = await testEnvironment(getLogger('apollo'), localization)
mutate = testEnv.mutate
query = testEnv.query
con = testEnv.con

View File

@ -90,7 +90,7 @@ import { delay } from '@/util/utilities'
import random from 'random-bigint'
import { randombytes_random } from 'sodium-native'
import { LOG4JS_RESOLVER_CATEGORY_NAME } from '@/graphql/resolver'
import { LOG4JS_BASE_CATEGORY_NAME } from '@/config/const'
import { Logger, getLogger } from 'log4js'
import { FULL_CREATION_AVAILABLE } from './const/const'
import { Location2Point, Point2Location } from './util/Location2Point'
@ -108,7 +108,7 @@ import { validateAlias } from 'core'
const LANGUAGES = ['de', 'en', 'es', 'fr', 'nl']
const DEFAULT_LANGUAGE = 'de'
const db = AppDatabase.getInstance()
const createLogger = () => getLogger(`${LOG4JS_RESOLVER_CATEGORY_NAME}.UserResolver`)
const createLogger = () => getLogger(`${LOG4JS_BASE_CATEGORY_NAME}.graphql.resolver.UserResolver`)
const isLanguage = (language: string): boolean => {
return LANGUAGES.includes(language)
}
@ -184,7 +184,6 @@ export class UserResolver {
await delay(650 + Math.floor(Math.random() * 101) - 50)
throw e
}
// TODO: discuss need we logging all this cases?
if (dbUser.deletedAt) {
logger.warn('login failed, user was deleted')
throw new Error('This user was permanently deleted. Contact support for questions')
@ -1198,7 +1197,6 @@ export async function findUserByEmail(email: string): Promise<DbUser> {
} catch (e) {
const logger = createLogger()
if (e instanceof EntityNotFoundError || (e as Error).name === 'EntityNotFoundError') {
// TODO: discuss if it is ok to print email in log for this case
logger.warn(`findUserByEmail failed, user with email=${email} not found`)
} else {
logger.error(`findUserByEmail failed, unknown error: ${e}`)

View File

@ -1,3 +0,0 @@
import { LOG4JS_BASE_CATEGORY_NAME } from '@/config/const'
export const LOG4JS_RESOLVER_CATEGORY_NAME = `${LOG4JS_BASE_CATEGORY_NAME}.graphql.resolver`

View File

@ -3,12 +3,12 @@ import { User as DbUser } from 'database'
import { verifyAuthToken } from '@/apis/gms/GmsClient'
import { CONFIG } from '@/config'
import { GmsUserAuthenticationResult } from '@/graphql/model/GmsUserAuthenticationResult'
import { LOG4JS_GRAPHQL_RESOLVER_UTIL_CATEGORY_NAME } from '@/graphql/resolver/util'
import { LOG4JS_BASE_CATEGORY_NAME } from '@/config/const'
import { ensureUrlEndsWithSlash } from '@/util/utilities'
import { getLogger } from 'log4js'
const logger = getLogger(
`${LOG4JS_GRAPHQL_RESOLVER_UTIL_CATEGORY_NAME}.authenticateGmsUserPlayground`,
`${LOG4JS_BASE_CATEGORY_NAME}.graphql.resolver.util.authenticateGmsUserPlayground`,
)
export async function authenticateGmsUserPlayground(

View File

@ -7,11 +7,11 @@ import { PublishNameType } from '@/graphql/enum/PublishNameType'
import { LogError } from '@/server/LogError'
import { getLogger } from 'log4js'
import { LOG4JS_GRAPHQL_RESOLVER_UTIL_CATEGORY_NAME } from '.'
import { LOG4JS_BASE_CATEGORY_NAME } from '@/config/const'
import { Point2Location } from './Location2Point'
const logger = getLogger(
`${LOG4JS_GRAPHQL_RESOLVER_UTIL_CATEGORY_NAME}.compareGmsRelevantUserSettings`,
`${LOG4JS_BASE_CATEGORY_NAME}.graphql.resolver.util.compareGmsRelevantUserSettings`,
)
export function compareGmsRelevantUserSettings(

View File

@ -4,14 +4,14 @@ import { Decimal } from 'decimal.js-light'
import { OpenCreation } from '@model/OpenCreation'
import { FULL_CREATION_AVAILABLE, MAX_CREATION_AMOUNT } from '@/graphql/resolver/const/const'
import { LOG4JS_GRAPHQL_RESOLVER_UTIL_CATEGORY_NAME } from '@/graphql/resolver/util'
import { LOG4JS_BASE_CATEGORY_NAME } from '@/config/const'
import { LogError } from '@/server/LogError'
import { getFirstDayOfPreviousNMonth } from '@/util/utilities'
import { AppDatabase } from 'database'
import { getLogger } from 'log4js'
const db = AppDatabase.getInstance()
const logger = getLogger(`${LOG4JS_GRAPHQL_RESOLVER_UTIL_CATEGORY_NAME}.creations`)
const logger = getLogger(`${LOG4JS_BASE_CATEGORY_NAME}.graphql.resolver.util.creations`)
interface CreationMap {
id: number

View File

@ -1,10 +1,10 @@
import { KlickTipp } from '@model/KlickTipp'
import { getKlickTippUser } from '@/apis/KlicktippController'
import { LOG4JS_GRAPHQL_RESOLVER_UTIL_CATEGORY_NAME } from '@/graphql/resolver/util'
import { LOG4JS_BASE_CATEGORY_NAME } from '@/config/const'
import { getLogger } from 'log4js'
const logger = getLogger(`${LOG4JS_GRAPHQL_RESOLVER_UTIL_CATEGORY_NAME}.getKlicktippState`)
const logger = getLogger(`${LOG4JS_BASE_CATEGORY_NAME}.graphql.resolver.util.getKlicktippState`)
export const getKlicktippState = async (email: string): Promise<KlickTipp> => {
try {

View File

@ -1,3 +0,0 @@
import { LOG4JS_RESOLVER_CATEGORY_NAME } from '@/graphql/resolver'
export const LOG4JS_GRAPHQL_RESOLVER_UTIL_CATEGORY_NAME = `${LOG4JS_RESOLVER_CATEGORY_NAME}.util`

View File

@ -14,7 +14,7 @@ import { SendCoinsResult } from '@/federation/client/1_0/model/SendCoinsResult'
import { SendCoinsClientFactory } from '@/federation/client/SendCoinsClientFactory'
import { PendingTransactionState } from '@/graphql/enum/PendingTransactionState'
import { TransactionTypeId } from '@/graphql/enum/TransactionTypeId'
import { LOG4JS_GRAPHQL_RESOLVER_UTIL_CATEGORY_NAME } from '@/graphql/resolver/util'
import { LOG4JS_BASE_CATEGORY_NAME } from '@/config/const'
import { LogError } from '@/server/LogError'
import { calculateSenderBalance } from '@/util/calculateSenderBalance'
import { fullName } from '@/util/utilities'
@ -22,7 +22,7 @@ import { getLogger } from 'log4js'
import { settlePendingSenderTransaction } from './settlePendingSenderTransaction'
const logger = getLogger(`${LOG4JS_GRAPHQL_RESOLVER_UTIL_CATEGORY_NAME}.processXComSendCoins`)
const logger = getLogger(`${LOG4JS_BASE_CATEGORY_NAME}.graphql.resolver.util.processXComSendCoins`)
export async function processXComPendingSendCoins(
receiverCom: DbCommunity,

View File

@ -21,14 +21,14 @@ import { bobBaumeister } from '@/seeds/users/bob-baumeister'
import { peterLustig } from '@/seeds/users/peter-lustig'
import { raeuberHotzenplotz } from '@/seeds/users/raeuber-hotzenplotz'
import { getLogger } from 'config-schema/test/testSetup'
import { LOG4JS_GRAPHQL_RESOLVER_UTIL_CATEGORY_NAME } from '.'
import { LOG4JS_BASE_CATEGORY_NAME } from '@/config/const'
import { sendTransactionsToDltConnector } from './sendTransactionsToDltConnector'
jest.mock('@/password/EncryptorUtils')
const logger = getLogger(
`${LOG4JS_GRAPHQL_RESOLVER_UTIL_CATEGORY_NAME}.sendTransactionsToDltConnector`,
`${LOG4JS_BASE_CATEGORY_NAME}.graphql.resolver.util.sendTransactionsToDltConnector`,
)
/*

View File

@ -3,12 +3,12 @@ import { IsNull } from 'typeorm'
import { DltConnectorClient } from '@dltConnector/DltConnectorClient'
import { LOG4JS_GRAPHQL_RESOLVER_UTIL_CATEGORY_NAME } from '@/graphql/resolver/util'
import { LOG4JS_BASE_CATEGORY_NAME } from '@/config/const'
import { Monitor, MonitorNames } from '@/util/Monitor'
import { getLogger } from 'log4js'
const logger = getLogger(
`${LOG4JS_GRAPHQL_RESOLVER_UTIL_CATEGORY_NAME}.sendTransactionsToDltConnector`,
`${LOG4JS_BASE_CATEGORY_NAME}.graphql.resolver.util.sendTransactionsToDltConnector`,
)
export async function sendTransactionsToDltConnector(): Promise<void> {

View File

@ -3,11 +3,11 @@ import { Community as DbCommunity, User as DbUser } from 'database'
import { createGmsUser, updateGmsUser } from '@/apis/gms/GmsClient'
import { GmsUser } from '@/apis/gms/model/GmsUser'
import { CONFIG } from '@/config'
import { LOG4JS_GRAPHQL_RESOLVER_UTIL_CATEGORY_NAME } from '@/graphql/resolver/util'
import { LOG4JS_BASE_CATEGORY_NAME } from '@/config/const'
import { LogError } from '@/server/LogError'
import { getLogger } from 'log4js'
const logger = getLogger(`${LOG4JS_GRAPHQL_RESOLVER_UTIL_CATEGORY_NAME}.sendUserToGms`)
const logger = getLogger(`${LOG4JS_BASE_CATEGORY_NAME}.graphql.resolver.util.sendUserToGms`)
export async function sendUserToGms(
user: DbUser,

View File

@ -8,7 +8,7 @@ import {
import { Decimal } from 'decimal.js-light'
import { PendingTransactionState } from '@/graphql/enum/PendingTransactionState'
import { LOG4JS_GRAPHQL_RESOLVER_UTIL_CATEGORY_NAME } from '@/graphql/resolver/util'
import { LOG4JS_BASE_CATEGORY_NAME } from '@/config/const'
import { LogError } from '@/server/LogError'
import { TRANSACTIONS_LOCK } from '@/util/TRANSACTIONS_LOCK'
import { calculateSenderBalance } from '@/util/calculateSenderBalance'
@ -17,7 +17,7 @@ import { getLastTransaction } from './getLastTransaction'
const db = AppDatabase.getInstance()
const logger = getLogger(
`${LOG4JS_GRAPHQL_RESOLVER_UTIL_CATEGORY_NAME}.settlePendingSenderTransaction`,
`${LOG4JS_BASE_CATEGORY_NAME}.graphql.resolver.util.settlePendingSenderTransaction`,
)
export async function settlePendingSenderTransaction(

View File

@ -1,10 +1,10 @@
import { Community as DbCommunity, User as DbUser } from 'database'
import { SendCoinsResult } from '@/federation/client/1_0/model/SendCoinsResult'
import { LOG4JS_GRAPHQL_RESOLVER_UTIL_CATEGORY_NAME } from '@/graphql/resolver/util'
import { LOG4JS_BASE_CATEGORY_NAME } from '@/config/const'
import { getLogger } from 'log4js'
const logger = getLogger(`${LOG4JS_GRAPHQL_RESOLVER_UTIL_CATEGORY_NAME}.storeForeignUser`)
const logger = getLogger(`${LOG4JS_BASE_CATEGORY_NAME}.graphql.resolver.util.storeForeignUser`)
export async function storeForeignUser(
recipCom: DbCommunity,

View File

@ -5,7 +5,7 @@ import { GetUser } from '@/apis/humhub/model/GetUser'
import { UpdateUserInfosArgs } from '@/graphql/arg/UpdateUserInfosArgs'
import { PublishNameType } from '@/graphql/enum/PublishNameType'
import { LOG4JS_GRAPHQL_RESOLVER_UTIL_CATEGORY_NAME } from '@/graphql/resolver/util'
import { LOG4JS_BASE_CATEGORY_NAME } from '@/config/const'
import { getLogger } from 'config-schema/test/testSetup'
import { syncHumhub } from './syncHumhub'
@ -20,7 +20,7 @@ mockUser.humhubPublishName = PublishNameType.PUBLISH_NAME_FULL
const mockUpdateUserInfosArg = new UpdateUserInfosArgs()
const mockHumHubUser = new GetUser(mockUser, 1)
const logger = getLogger(`${LOG4JS_GRAPHQL_RESOLVER_UTIL_CATEGORY_NAME}.syncHumhub`)
const logger = getLogger(`${LOG4JS_BASE_CATEGORY_NAME}.graphql.resolver.util.syncHumhub`)
describe('syncHumhub', () => {
beforeEach(() => {

View File

@ -7,10 +7,10 @@ import { ExecutedHumhubAction, syncUser } from '@/apis/humhub/syncUser'
import { PublishNameLogic } from '@/data/PublishName.logic'
import { UpdateUserInfosArgs } from '@/graphql/arg/UpdateUserInfosArgs'
import { PublishNameType } from '@/graphql/enum/PublishNameType'
import { LOG4JS_GRAPHQL_RESOLVER_UTIL_CATEGORY_NAME } from '@/graphql/resolver/util'
import { LOG4JS_BASE_CATEGORY_NAME } from '@/config/const'
import { getLogger } from 'log4js'
const createLogger = () => getLogger(`${LOG4JS_GRAPHQL_RESOLVER_UTIL_CATEGORY_NAME}.syncHumhub`)
const createLogger = () => getLogger(`${LOG4JS_BASE_CATEGORY_NAME}.graphql.resolver.util.syncHumhub`)
/**
* Syncs the user with humhub

View File

@ -1,3 +0,0 @@
import { LOG4JS_BASE_CATEGORY_NAME } from '@/config/const'
export const LOG4JS_INTERACTION_CATEGORY_NAME = `${LOG4JS_BASE_CATEGORY_NAME}.interaction`

View File

@ -5,10 +5,10 @@ import { Role } from '@/auth/Role'
import { ContributionLogic } from '@/data/Contribution.logic'
import { ContributionMessageBuilder } from '@/data/ContributionMessage.builder'
import { ContributionStatus } from '@/graphql/enum/ContributionStatus'
import { LOG4JS_INTERACTION_CATEGORY_NAME } from '@/interactions'
import { LogError } from '@/server/LogError'
import { Context, getClientTimezoneOffset } from '@/server/context'
import { Logger, getLogger } from 'log4js'
import { LOG4JS_BASE_CATEGORY_NAME } from '@/config/const'
export abstract class AbstractUnconfirmedContributionRole {
private availableCreationSums?: Decimal[]
@ -24,7 +24,7 @@ export abstract class AbstractUnconfirmedContributionRole {
if (self.confirmedAt || self.deniedAt) {
throw new LogError("this contribution isn't unconfirmed!")
}
this.logger = getLogger(`${LOG4JS_INTERACTION_CATEGORY_NAME}.updateUnconfirmedContribution`)
this.logger = getLogger(`${LOG4JS_BASE_CATEGORY_NAME}.interactions.updateUnconfirmedContribution`)
this.logger.addContext('contribution', this.self.id)
}

View File

@ -15,11 +15,11 @@ export const userFactory = async (
const { mutate } = client
const homeCom = await writeHomeCommunityEntry()
// console.log('call createUser with', JSON.stringify(user, null, 2))
const response = await mutate({ mutation: createUser, variables: user })
if (!response?.data?.createUser) {
// biome-ignore lint/suspicious/noConsole: will be used in tests where logging is mocked
console.log(response)
// console.log(JSON.stringify(response, null, 2))
throw new Error('createUser mutation returned unexpected response')
}
const {

View File

@ -3,11 +3,11 @@ import { Community as DbCommunity, FederatedCommunity as DbFederatedCommunity }
import { validate as validateUUID, version as versionUUID } from 'uuid'
import { cleanDB, testEnvironment } from '@test/helpers'
import { clearLogs, getLogger, printLogs } from 'config-schema/test/testSetup'
import { getLogger } from 'config-schema/test/testSetup'
import { LOG4JS_BASE_CATEGORY_NAME } from '@/config/const'
import { CONFIG } from '@/config'
import { LOG_CATEGORY_DHT_NODE, startDHT } from './index'
import { startDHT } from './index'
CONFIG.FEDERATION_DHT_SEED = '64ebcb0e3ad547848fef4197c6e2332f'
CONFIG.FEDERATION_COMMUNITY_APIS = '1_0,1_1,2_0'
@ -21,7 +21,7 @@ const keyPairMock = {
secretKey: Buffer.from('secretKey'),
}
const logger = getLogger(LOG_CATEGORY_DHT_NODE)
const logger = getLogger(`${LOG4JS_BASE_CATEGORY_NAME}.dht_node`)
const serverListenSpy = jest.fn()
@ -358,7 +358,6 @@ describe('federation', () => {
let jsonArray: any[]
let result: DbFederatedCommunity[] = []
beforeAll(async () => {
clearLogs()
jest.clearAllMocks()
jsonArray = [
{
@ -374,7 +373,6 @@ describe('federation', () => {
]
await socketEventMocks.data(Buffer.from(JSON.stringify(jsonArray)))
result = await DbFederatedCommunity.find({ where: { foreign: true } })
printLogs()
})
afterAll(async () => {

View File

@ -19,8 +19,7 @@ const POLLTIME = 20000
const SUCCESSTIME = 120000
const ERRORTIME = 240000
const ANNOUNCETIME = 30000
export const LOG_CATEGORY_DHT_NODE = `${LOG4JS_BASE_CATEGORY_NAME}.dht_node`
const logger = getLogger(LOG_CATEGORY_DHT_NODE)
const logger = getLogger(`${LOG4JS_BASE_CATEGORY_NAME}.dht_node`)
type CommunityApi = {
api: string

View File

@ -1,14 +1,14 @@
import { FederatedCommunity as DbFederatedCommunity } from 'database'
import { GraphQLClient } from 'graphql-request'
import { getLogger } from 'log4js'
import { LOG4JS_BASE_CATEGORY_NAME } from '@/config/const'
import { AuthenticationArgs } from '@/graphql/api/1_0/model/AuthenticationArgs'
import { OpenConnectionCallbackArgs } from '@/graphql/api/1_0/model/OpenConnectionCallbackArgs'
import { LOG4JS_CLIENT_1_0_CATEGORY_NAME } from '.'
import { authenticate } from './query/authenticate'
import { openConnectionCallback } from './query/openConnectionCallback'
const logger = getLogger(`${LOG4JS_CLIENT_1_0_CATEGORY_NAME}.AuthenticationClient`)
const logger = getLogger(`${LOG4JS_BASE_CATEGORY_NAME}.client.1_0.AuthenticationClient`)
export class AuthenticationClient {
dbCom: DbFederatedCommunity

View File

@ -1,3 +0,0 @@
import { LOG4JS_BASE_CATEGORY_NAME } from '@/config/const'
export const LOG4JS_CLIENT_1_0_CATEGORY_NAME = `${LOG4JS_BASE_CATEGORY_NAME}.client.1_0`

View File

@ -1,3 +0,0 @@
import { LOG4JS_API_CATEGORY_NAME } from '@/graphql/api'
export const LOG4JS_API_1_0_CATEGORY_NAME = `${LOG4JS_API_CATEGORY_NAME}.1_0`

View File

@ -8,13 +8,13 @@ import {
} from 'database'
import { getLogger } from 'log4js'
import { Arg, Mutation, Resolver } from 'type-graphql'
import { LOG4JS_RESOLVER_1_0_CATEGORY_NAME } from '.'
import { LOG4JS_BASE_CATEGORY_NAME } from '@/config/const'
import { AuthenticationArgs } from '../model/AuthenticationArgs'
import { OpenConnectionArgs } from '../model/OpenConnectionArgs'
import { OpenConnectionCallbackArgs } from '../model/OpenConnectionCallbackArgs'
import { startAuthentication, startOpenConnectionCallback } from '../util/authenticateCommunity'
const logger = getLogger(`${LOG4JS_RESOLVER_1_0_CATEGORY_NAME}.AuthenticationResolver`)
const logger = getLogger(`${LOG4JS_BASE_CATEGORY_NAME}.graphql.api.1_0.resolver.AuthenticationResolver`)
@Resolver()
export class AuthenticationResolver {

View File

@ -1,5 +1,4 @@
import { CONFIG } from '@/config'
import { LOG4JS_BASE_CATEGORY_NAME } from '@/config/const'
import { createServer } from '@/server/createServer'
import { createTestClient } from 'apollo-server-testing'
import { Community as DbCommunity } from 'database'
@ -14,7 +13,7 @@ let con: DataSource
CONFIG.FEDERATION_API = '1_0'
beforeAll(async () => {
const server = await createServer(getLogger(`${LOG4JS_BASE_CATEGORY_NAME}.apollo`))
const server = await createServer(getLogger('apollo'))
con = server.con
query = createTestClient(server.apollo).query
DbCommunity.clear()

View File

@ -1,11 +1,11 @@
import { Community as DbCommunity } from 'database'
import { getLogger } from 'log4js'
import { Query, Resolver } from 'type-graphql'
import { LOG4JS_RESOLVER_1_0_CATEGORY_NAME } from '.'
import { LOG4JS_BASE_CATEGORY_NAME } from '@/config/const'
import { GetPublicCommunityInfoResultLoggingView } from '../logger/GetPublicCommunityInfoResultLogging.view'
import { GetPublicCommunityInfoResult } from '../model/GetPublicCommunityInfoResult'
const logger = getLogger(`${LOG4JS_RESOLVER_1_0_CATEGORY_NAME}.PublicCommunityInfoResolver`)
const logger = getLogger(`${LOG4JS_BASE_CATEGORY_NAME}.graphql.api.1_0.resolver.PublicCommunityInfoResolver`)
@Resolver()
export class PublicCommunityInfoResolver {

View File

@ -13,7 +13,7 @@ let con: any
CONFIG.FEDERATION_API = '1_0'
beforeAll(async () => {
const server = await createServer(getLogger(`${LOG4JS_BASE_CATEGORY_NAME}.apollo`))
const server = await createServer(getLogger('apollo'))
con = server.con
query = createTestClient(server.apollo).query
DbFederatedCommunity.clear()

View File

@ -1,10 +1,10 @@
import { FederatedCommunity as DbFederatedCommunity } from 'database'
import { getLogger } from 'log4js'
import { Query, Resolver } from 'type-graphql'
import { LOG4JS_RESOLVER_1_0_CATEGORY_NAME } from '.'
import { LOG4JS_BASE_CATEGORY_NAME } from '@/config/const'
import { GetPublicKeyResult } from '../model/GetPublicKeyResult'
const logger = getLogger(`${LOG4JS_RESOLVER_1_0_CATEGORY_NAME}.PublicKeyResolver`)
const logger = getLogger(`${LOG4JS_BASE_CATEGORY_NAME}.graphql.api.1_0.resolver.PublicKeyResolver`)
@Resolver()
export class PublicKeyResolver {

View File

@ -29,7 +29,7 @@ let recipUser: DbUser
let recipContact: DbUserContact
beforeAll(async () => {
testEnv = await testEnvironment(getLogger(`${LOG4JS_BASE_CATEGORY_NAME}.apollo`))
testEnv = await testEnvironment(getLogger('apollo'))
mutate = testEnv.mutate
// query = testEnv.query
// con = testEnv.con

View File

@ -9,7 +9,7 @@ import {
import Decimal from 'decimal.js-light'
import { getLogger } from 'log4js'
import { Arg, Mutation, Resolver } from 'type-graphql'
import { LOG4JS_RESOLVER_1_0_CATEGORY_NAME } from '.'
import { LOG4JS_BASE_CATEGORY_NAME } from '@/config/const'
import { PendingTransactionState } from '../enum/PendingTransactionState'
import { TransactionTypeId } from '../enum/TransactionTypeId'
import { SendCoinsArgsLoggingView } from '../logger/SendCoinsArgsLogging.view'
@ -21,7 +21,7 @@ import { revertSettledReceiveTransaction } from '../util/revertSettledReceiveTra
import { settlePendingReceiveTransaction } from '../util/settlePendingReceiveTransaction'
import { storeForeignUser } from '../util/storeForeignUser'
const logger = getLogger(`${LOG4JS_RESOLVER_1_0_CATEGORY_NAME}.SendCoinsResolver`)
const logger = getLogger(`${LOG4JS_BASE_CATEGORY_NAME}.graphql.api.1_0.resolver.SendCoinsResolver`)
@Resolver()
export class SendCoinsResolver {

View File

@ -1,3 +0,0 @@
import { LOG4JS_API_1_0_CATEGORY_NAME } from '@/graphql/api/1_0'
export const LOG4JS_RESOLVER_1_0_CATEGORY_NAME = `${LOG4JS_API_1_0_CATEGORY_NAME}.resolver`

View File

@ -12,10 +12,10 @@ import { AuthenticationClientFactory } from '@/client/AuthenticationClientFactor
import { randombytes_random } from 'sodium-native'
import { AuthenticationClient as V1_0_AuthenticationClient } from '@/client/1_0/AuthenticationClient'
import { LOG4JS_1_0_UTIL_CATEGORY_NAME } from '.'
import { LOG4JS_BASE_CATEGORY_NAME } from '@/config/const'
import { AuthenticationArgs } from '../model/AuthenticationArgs'
const logger = getLogger(`${LOG4JS_1_0_UTIL_CATEGORY_NAME}.authenticateCommunity`)
const logger = getLogger(`${LOG4JS_BASE_CATEGORY_NAME}.graphql.api.1_0.util.authenticateCommunity`)
export async function startOpenConnectionCallback(
args: OpenConnectionArgs,

View File

@ -1,3 +0,0 @@
import { LOG4JS_API_1_0_CATEGORY_NAME } from '@/graphql/api/1_0'
export const LOG4JS_1_0_UTIL_CATEGORY_NAME = `${LOG4JS_API_1_0_CATEGORY_NAME}.util`

View File

@ -14,13 +14,13 @@ import { PendingTransactionState } from '../enum/PendingTransactionState'
import { LogError } from '@/server/LogError'
import { getLogger } from 'log4js'
import { LOG4JS_1_0_UTIL_CATEGORY_NAME } from '.'
import { LOG4JS_BASE_CATEGORY_NAME } from '@/config/const'
import { TRANSACTIONS_LOCK } from '@/graphql/util/TRANSACTIONS_LOCK'
import { getLastTransaction } from '@/graphql/util/getLastTransaction'
const db = AppDatabase.getInstance()
const logger = getLogger(`${LOG4JS_1_0_UTIL_CATEGORY_NAME}.revertSettledReceiveTransaction`)
const logger = getLogger(`${LOG4JS_BASE_CATEGORY_NAME}.graphql.api.1_0.util.revertSettledReceiveTransaction`)
export async function revertSettledReceiveTransaction(
homeCom: DbCommunity,

View File

@ -17,11 +17,11 @@ import { TRANSACTIONS_LOCK } from '@/graphql/util/TRANSACTIONS_LOCK'
import { getLastTransaction } from '@/graphql/util/getLastTransaction'
import Decimal from 'decimal.js-light'
import { getLogger } from 'log4js'
import { LOG4JS_1_0_UTIL_CATEGORY_NAME } from '.'
import { LOG4JS_BASE_CATEGORY_NAME } from '@/config/const'
import { calculateRecipientBalance } from './calculateRecipientBalance'
const db = AppDatabase.getInstance()
const logger = getLogger(`${LOG4JS_1_0_UTIL_CATEGORY_NAME}.settlePendingReceiveTransaction`)
const logger = getLogger(`${LOG4JS_BASE_CATEGORY_NAME}.graphql.api.1_0.util.settlePendingReceiveTransaction`)
export async function settlePendingReceiveTransaction(
homeCom: DbCommunity,

View File

@ -1,11 +1,11 @@
import { User as DbUser, UserLoggingView } from 'database'
import { getLogger } from 'log4js'
import { LOG4JS_1_0_UTIL_CATEGORY_NAME } from '.'
import { LOG4JS_BASE_CATEGORY_NAME } from '@/config/const'
import { SendCoinsArgsLoggingView } from '../logger/SendCoinsArgsLogging.view'
import { SendCoinsArgs } from '../model/SendCoinsArgs'
const logger = getLogger(`${LOG4JS_1_0_UTIL_CATEGORY_NAME}.storeForeignUser`)
const logger = getLogger(`${LOG4JS_BASE_CATEGORY_NAME}.graphql.api.1_0.util.storeForeignUser`)
export async function storeForeignUser(args: SendCoinsArgs): Promise<boolean> {
if (args.senderCommunityUuid !== null && args.senderUserUuid !== null) {

View File

@ -1,10 +1,10 @@
import { FederatedCommunity as DbFederatedCommunity } from 'database'
import { getLogger } from 'log4js'
import { Query, Resolver } from 'type-graphql'
import { LOG4JS_RESOLVER_1_1_CATEGORY_NAME } from '.'
import { LOG4JS_BASE_CATEGORY_NAME } from '@/config/const'
import { GetPublicKeyResult } from '../../1_0/model/GetPublicKeyResult'
const logger = getLogger(`${LOG4JS_RESOLVER_1_1_CATEGORY_NAME}.PublicKeyResolver`)
const logger = getLogger(`${LOG4JS_BASE_CATEGORY_NAME}.graphql.api.1_1.resolver.PublicKeyResolver`)
@Resolver()
export class PublicKeyResolver {

View File

@ -1,3 +0,0 @@
import { LOG4JS_API_CATEGORY_NAME } from '@/graphql/api'
export const LOG4JS_RESOLVER_1_1_CATEGORY_NAME = `${LOG4JS_API_CATEGORY_NAME}.1_1.resolver`

View File

@ -1,3 +0,0 @@
import { LOG4JS_GRAPHQL_CATEGORY_NAME } from '@/graphql'
export const LOG4JS_API_CATEGORY_NAME = `${LOG4JS_GRAPHQL_CATEGORY_NAME}.api`

View File

@ -1,13 +1,13 @@
import { getLogger } from 'log4js'
import { NonEmptyArray } from 'type-graphql'
import { LOG4JS_API_CATEGORY_NAME } from '.'
import { LOG4JS_BASE_CATEGORY_NAME } from '@/config/const'
// config
import { CONFIG } from '../../config'
import { getApiResolvers as getApiResolvers_1_0 } from './1_0/schema'
import { getApiResolvers as getApiResolvers_1_1 } from './1_1/schema'
export const getApiResolvers = (): NonEmptyArray<Function> => {
getLogger(LOG4JS_API_CATEGORY_NAME).info(`getApiResolvers...${CONFIG.FEDERATION_API}`)
getLogger(LOG4JS_BASE_CATEGORY_NAME).info(`getApiResolvers...${CONFIG.FEDERATION_API}`)
if (CONFIG.FEDERATION_API === '1_0') {
return getApiResolvers_1_0()

View File

@ -1,3 +0,0 @@
import { LOG4JS_BASE_CATEGORY_NAME } from '@/config/const'
export const LOG4JS_GRAPHQL_CATEGORY_NAME = `${LOG4JS_BASE_CATEGORY_NAME}.graphql`

View File

@ -1,11 +1,11 @@
import { CONFIG } from '@/config'
import { LOG4JS_GRAPHQL_UTIL_CATEGORY_NAME } from '@/graphql/util'
import { Community as DbCommunity } from 'database'
import { Decimal } from 'decimal.js-light'
import { getLogger } from 'log4js'
import { LOG4JS_BASE_CATEGORY_NAME } from '@/config/const'
export async function checkTradingLevel(homeCom: DbCommunity, amount: Decimal): Promise<boolean> {
const logger = getLogger(`${LOG4JS_GRAPHQL_UTIL_CATEGORY_NAME}.checkTradingLevel`)
const logger = getLogger(`${LOG4JS_BASE_CATEGORY_NAME}.graphql.util.checkTradingLevel`)
const tradingLevel = CONFIG.FEDERATION_TRADING_LEVEL
if (homeCom.url !== tradingLevel.RECEIVER_COMMUNITY_URL) {

View File

@ -1,3 +0,0 @@
import { LOG4JS_GRAPHQL_CATEGORY_NAME } from '@/graphql'
export const LOG4JS_GRAPHQL_UTIL_CATEGORY_NAME = `${LOG4JS_GRAPHQL_CATEGORY_NAME}.util`