Merge pull request #3270 from gradido/dlt_logging_views

feat(dlt): logging views
This commit is contained in:
einhornimmond 2024-01-18 20:32:04 +01:00 committed by GitHub
commit 6ea73b4d1a
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
33 changed files with 557 additions and 15 deletions

View File

@ -6,7 +6,7 @@ module.exports = {
collectCoverageFrom: ['src/**/*.ts', '!**/node_modules/**', '!src/seeds/**', '!build/**'],
coverageThreshold: {
global: {
lines: 71,
lines: 66,
},
},
setupFiles: ['<rootDir>/test/testSetup.ts'],

View File

@ -1,5 +1,8 @@
import { Field, Message } from 'protobufjs'
import { TransactionErrorType } from '@/graphql/enum/TransactionErrorType'
import { TransactionError } from '@/graphql/model/TransactionError'
import { logger } from '@/logging/logger'
import { LogError } from '@/server/LogError'
import { SignatureMap } from './SignatureMap'
@ -41,4 +44,16 @@ export class GradidoTransaction extends Message<GradidoTransaction> {
}
return sigPair[0]
}
getTransactionBody(): TransactionBody {
try {
return TransactionBody.decode(new Uint8Array(this.bodyBytes))
} catch (error) {
logger.error('error decoding body from gradido transaction: %s', error)
throw new TransactionError(
TransactionErrorType.PROTO_DECODE_ERROR,
'cannot decode body from gradido transaction',
)
}
}
}

View File

@ -9,8 +9,8 @@ import { TransactionResult } from '@model/TransactionResult'
import { CommunityRepository } from '@/data/Community.repository'
import { AddCommunityContext } from '@/interactions/backendToDb/community/AddCommunity.context'
import { logger } from '@/logging/logger'
import { LogError } from '@/server/LogError'
import { logger } from '@/server/logger'
import { iotaTopicFromCommunityUUID } from '@/utils/typeConverter'
@Resolver()

View File

@ -4,6 +4,9 @@ import { TransactionDraft } from '@input/TransactionDraft'
import { TransactionRepository } from '@/data/Transaction.repository'
import { CreateTransactionRecipeContext } from '@/interactions/backendToDb/transaction/CreateTransationRecipe.context'
import { BackendTransactionLoggingView } from '@/logging/BackendTransactionLogging.view'
import { logger } from '@/logging/logger'
import { TransactionLoggingView } from '@/logging/TransactionLogging.view'
import { LogError } from '@/server/LogError'
import { TransactionError } from '../model/TransactionError'
@ -35,8 +38,13 @@ export class TransactionResolver {
}
const backendTransaction = transactionRecipe.backendTransactions[0]
backendTransaction.transactionId = transactionRecipe.id
logger.debug(
'store backendTransaction',
new BackendTransactionLoggingView(backendTransaction),
)
await backendTransaction.save()
} else {
logger.debug('store transaction recipe', new TransactionLoggingView(transactionRecipe))
// we can store the transaction and with that automatic the backend transaction
await transactionRecipe.save()
}

View File

@ -10,7 +10,6 @@ export const schema = async (): Promise<GraphQLSchema> => {
return buildSchema({
resolvers: [TransactionResolver, CommunityResolver],
scalarsMap: [{ type: Decimal, scalar: DecimalScalar }],
emitSchemaFile: true,
validate: {
validationError: { target: false },
skipMissingProperties: true,

View File

@ -3,7 +3,8 @@ import { Community } from '@entity/Community'
import { TransactionErrorType } from '@/graphql/enum/TransactionErrorType'
import { CommunityDraft } from '@/graphql/input/CommunityDraft'
import { TransactionError } from '@/graphql/model/TransactionError'
import { logger } from '@/server/logger'
import { CommunityLoggingView } from '@/logging/CommunityLogging.view'
import { logger } from '@/logging/logger'
export abstract class CommunityRole {
protected self: Community
@ -17,9 +18,11 @@ export abstract class CommunityRole {
this.self.foreign = communityDraft.foreign
}
public store(): Promise<Community> {
public async store(): Promise<Community> {
try {
return this.self.save()
const community = await this.self.save()
logger.debug('store community', new CommunityLoggingView(community))
return community
} catch (error) {
logger.error('error saving new community into db: %s', error)
throw new TransactionError(TransactionErrorType.DB_ERROR, 'error saving community into db')

View File

@ -8,7 +8,8 @@ import { Mnemonic } from '@/data/Mnemonic'
import { TransactionErrorType } from '@/graphql/enum/TransactionErrorType'
import { CommunityDraft } from '@/graphql/input/CommunityDraft'
import { TransactionError } from '@/graphql/model/TransactionError'
import { logger } from '@/server/logger'
import { CommunityLoggingView } from '@/logging/CommunityLogging.view'
import { logger } from '@/logging/logger'
import { getDataSource } from '@/typeorm/DataSource'
import { CreateTransactionRecipeContext } from '../transaction/CreateTransationRecipe.context'
@ -38,6 +39,7 @@ export class HomeCommunityRole extends CommunityRole {
return await getDataSource().transaction(async (transactionalEntityManager) => {
const community = await transactionalEntityManager.save(this.self)
await transactionalEntityManager.save(this.transactionRecipe)
logger.debug('store home community', new CommunityLoggingView(community))
return community
})
} catch (error) {

View File

@ -0,0 +1,49 @@
import util from 'util'
import { Decimal } from 'decimal.js-light'
import { Timestamp } from '@/data/proto/3_3/Timestamp'
import { TimestampSeconds } from '@/data/proto/3_3/TimestampSeconds'
import { timestampSecondsToDate, timestampToDate } from '@/utils/typeConverter'
export abstract class AbstractLoggingView {
protected bufferStringFormat: BufferEncoding = 'hex'
// This function gets called automatically when JSON.stringify() is called on this class instance
// eslint-disable-next-line @typescript-eslint/no-explicit-any
public abstract toJSON(): any
public toString(): string {
return JSON.stringify(this.toJSON(), null, 2)
}
// called form console.log or log4js logging functions
[util.inspect.custom](): string {
return this.toString()
}
protected dateToString(date: Date | undefined | null): string | undefined {
if (date) {
return date.toISOString()
}
return undefined
}
protected decimalToString(number: Decimal | undefined | null): string | undefined {
if (number) {
return number.toString()
}
return undefined
}
protected timestampSecondsToDateString(timestamp: TimestampSeconds): string | undefined {
if (timestamp && timestamp.seconds) {
return timestampSecondsToDate(timestamp).toISOString()
}
}
protected timestampToDateString(timestamp: Timestamp): string | undefined {
if (timestamp && (timestamp.seconds || timestamp.nanoSeconds)) {
return timestampToDate(timestamp).toISOString()
}
}
}

View File

@ -0,0 +1,29 @@
import { Account } from '@entity/Account'
import { AddressType } from '@/data/proto/3_3/enum/AddressType'
import { getEnumValue } from '@/utils/typeConverter'
import { AbstractLoggingView } from './AbstractLogging.view'
import { UserLoggingView } from './UserLogging.view'
export class AccountLoggingView extends AbstractLoggingView {
public constructor(private account: Account) {
super()
}
public toJSON() {
return {
id: this.account.id,
user: this.account.user ? new UserLoggingView(this.account.user).toJSON() : null,
derivationIndex: this.account.derivationIndex,
derive2pubkey: this.account.derive2Pubkey.toString(this.bufferStringFormat),
type: getEnumValue(AddressType, this.account.type),
createdAt: this.dateToString(this.account.createdAt),
confirmedAt: this.dateToString(this.account.confirmedAt),
balanceOnConfirmation: this.decimalToString(this.account.balanceOnConfirmation),
balanceConfirmedAt: this.dateToString(this.account.balanceConfirmedAt),
balanceOnCreation: this.decimalToString(this.account.balanceOnCreation),
balanceCreatedAt: this.dateToString(this.account.balanceCreatedAt),
}
}
}

View File

@ -0,0 +1,30 @@
import { BackendTransaction } from '@entity/BackendTransaction'
import { InputTransactionType } from '@/graphql/enum/InputTransactionType'
import { getEnumValue } from '@/utils/typeConverter'
import { AbstractLoggingView } from './AbstractLogging.view'
import { TransactionLoggingView } from './TransactionLogging.view'
export class BackendTransactionLoggingView extends AbstractLoggingView {
public constructor(private self: BackendTransaction) {
super()
}
// eslint-disable-next-line @typescript-eslint/no-explicit-any
public toJSON(showTransaction = true): any {
return {
id: this.self.id,
backendTransactionId: this.self.backendTransactionId,
transaction:
showTransaction && this.self.transaction
? new TransactionLoggingView(this.self.transaction).toJSON(false)
: undefined,
type: getEnumValue(InputTransactionType, this.self.typeId),
balance: this.decimalToString(this.self.balance),
createdAt: this.dateToString(this.self.createdAt),
confirmedAt: this.dateToString(this.self.confirmedAt),
verifiedOnBackend: this.self.verifiedOnBackend,
}
}
}

View File

@ -0,0 +1,24 @@
import { Community } from '@entity/Community'
import { AbstractLoggingView } from './AbstractLogging.view'
import { AccountLoggingView } from './AccountLogging.view'
export class CommunityLoggingView extends AbstractLoggingView {
public constructor(private self: Community) {
super()
}
// eslint-disable-next-line @typescript-eslint/no-explicit-any
public toJSON(): any {
return {
id: this.self.id,
iotaTopic: this.self.iotaTopic,
foreign: this.self.foreign,
publicKey: this.self.rootPubkey?.toString(this.bufferStringFormat),
createdAt: this.dateToString(this.self.createdAt),
confirmedAt: this.dateToString(this.self.confirmedAt),
aufAccount: this.self.aufAccount ? new AccountLoggingView(this.self.aufAccount) : undefined,
gmwAccount: this.self.gmwAccount ? new AccountLoggingView(this.self.gmwAccount) : undefined,
}
}
}

View File

@ -0,0 +1,18 @@
import { CommunityRoot } from '@/data/proto/3_3/CommunityRoot'
import { AbstractLoggingView } from './AbstractLogging.view'
export class CommunityRootLoggingView extends AbstractLoggingView {
public constructor(private self: CommunityRoot) {
super()
}
// eslint-disable-next-line @typescript-eslint/no-explicit-any
public toJSON(): any {
return {
rootPubkey: Buffer.from(this.self.rootPubkey).toString(this.bufferStringFormat),
gmwPubkey: Buffer.from(this.self.gmwPubkey).toString(this.bufferStringFormat),
aufPubkey: Buffer.from(this.self.aufPubkey).toString(this.bufferStringFormat),
}
}
}

View File

@ -0,0 +1,24 @@
import { ConfirmedTransaction } from '@/data/proto/3_3/ConfirmedTransaction'
import { timestampSecondsToDate } from '@/utils/typeConverter'
import { AbstractLoggingView } from './AbstractLogging.view'
import { GradidoTransactionLoggingView } from './GradidoTransactionLogging.view'
export class ConfirmedTransactionLoggingView extends AbstractLoggingView {
public constructor(private self: ConfirmedTransaction) {
super()
}
// eslint-disable-next-line @typescript-eslint/no-explicit-any
public toJSON(): any {
return {
id: this.self.id.toString(),
transaction: new GradidoTransactionLoggingView(this.self.transaction).toJSON(),
confirmedAt: this.dateToString(timestampSecondsToDate(this.self.confirmedAt)),
versionNumber: this.self.versionNumber,
runningHash: Buffer.from(this.self.runningHash).toString(this.bufferStringFormat),
messageId: Buffer.from(this.self.messageId).toString(this.bufferStringFormat),
accountBalance: this.self.accountBalance,
}
}
}

View File

@ -0,0 +1,18 @@
import { GradidoCreation } from '@/data/proto/3_3/GradidoCreation'
import { AbstractLoggingView } from './AbstractLogging.view'
import { TransferAmountLoggingView } from './TransferAmountLogging.view'
export class GradidoCreationLoggingView extends AbstractLoggingView {
public constructor(private self: GradidoCreation) {
super()
}
// eslint-disable-next-line @typescript-eslint/no-explicit-any
public toJSON(): any {
return {
recipient: new TransferAmountLoggingView(this.self.recipient).toJSON(),
targetDate: this.timestampSecondsToDateString(this.self.targetDate),
}
}
}

View File

@ -0,0 +1,18 @@
import { GradidoDeferredTransfer } from '@/data/proto/3_3/GradidoDeferredTransfer'
import { AbstractLoggingView } from './AbstractLogging.view'
import { GradidoTransferLoggingView } from './GradidoTransferLogging.view'
export class GradidoDeferredTransferLoggingView extends AbstractLoggingView {
public constructor(private self: GradidoDeferredTransfer) {
super()
}
// eslint-disable-next-line @typescript-eslint/no-explicit-any
public toJSON(): any {
return {
...new GradidoTransferLoggingView(this.self.transfer).toJSON(),
...{ timeout: this.timestampSecondsToDateString(this.self.timeout) },
}
}
}

View File

@ -0,0 +1,29 @@
import { GradidoTransaction } from '@/data/proto/3_3/GradidoTransaction'
import { TransactionBody } from '@/data/proto/3_3/TransactionBody'
import { AbstractLoggingView } from './AbstractLogging.view'
import { SignatureMapLoggingView } from './SignatureMapLogging.view'
import { TransactionBodyLoggingView } from './TransactionBodyLogging.view'
export class GradidoTransactionLoggingView extends AbstractLoggingView {
public constructor(private self: GradidoTransaction) {
super()
}
// eslint-disable-next-line @typescript-eslint/no-explicit-any
public toJSON(): any {
let transactionBody: TransactionBody | null | unknown = null
try {
transactionBody = new TransactionBodyLoggingView(this.self.getTransactionBody())
} catch (e) {
transactionBody = e
}
return {
sigMap: new SignatureMapLoggingView(this.self.sigMap).toJSON(),
bodyBytes: transactionBody,
parentMessageId: this.self.parentMessageId
? Buffer.from(this.self.parentMessageId).toString(this.bufferStringFormat)
: undefined,
}
}
}

View File

@ -0,0 +1,18 @@
import { GradidoTransfer } from '@/data/proto/3_3/GradidoTransfer'
import { AbstractLoggingView } from './AbstractLogging.view'
import { TransferAmountLoggingView } from './TransferAmountLogging.view'
export class GradidoTransferLoggingView extends AbstractLoggingView {
public constructor(private self: GradidoTransfer) {
super()
}
// eslint-disable-next-line @typescript-eslint/no-explicit-any
public toJSON(): any {
return {
sender: new TransferAmountLoggingView(this.self.sender),
recipient: Buffer.from(this.self.recipient).toString(this.bufferStringFormat),
}
}
}

View File

@ -0,0 +1,16 @@
import { GroupFriendsUpdate } from '@/data/proto/3_3/GroupFriendsUpdate'
import { AbstractLoggingView } from './AbstractLogging.view'
export class GroupFriendsUpdateLoggingView extends AbstractLoggingView {
public constructor(private self: GroupFriendsUpdate) {
super()
}
// eslint-disable-next-line @typescript-eslint/no-explicit-any
public toJSON(): any {
return {
colorFusion: this.self.colorFusion,
}
}
}

View File

@ -0,0 +1,22 @@
import { AddressType } from '@/data/proto/3_3/enum/AddressType'
import { RegisterAddress } from '@/data/proto/3_3/RegisterAddress'
import { getEnumValue } from '@/utils/typeConverter'
import { AbstractLoggingView } from './AbstractLogging.view'
export class RegisterAddressLoggingView extends AbstractLoggingView {
public constructor(private self: RegisterAddress) {
super()
}
// eslint-disable-next-line @typescript-eslint/no-explicit-any
public toJSON(): any {
return {
userPublicKey: Buffer.from(this.self.userPubkey).toString(this.bufferStringFormat),
addressType: getEnumValue(AddressType, this.self.addressType),
nameHash: Buffer.from(this.self.nameHash).toString(this.bufferStringFormat),
accountPublicKey: Buffer.from(this.self.accountPubkey).toString(this.bufferStringFormat),
derivationIndex: this.self.derivationIndex,
}
}
}

View File

@ -0,0 +1,17 @@
import { SignatureMap } from '@/data/proto/3_3/SignatureMap'
import { AbstractLoggingView } from './AbstractLogging.view'
import { SignaturePairLoggingView } from './SignaturePairLogging.view'
export class SignatureMapLoggingView extends AbstractLoggingView {
public constructor(private self: SignatureMap) {
super()
}
// eslint-disable-next-line @typescript-eslint/no-explicit-any
public toJSON(): any {
return {
sigPair: this.self.sigPair.map((value) => new SignaturePairLoggingView(value).toJSON()),
}
}
}

View File

@ -0,0 +1,18 @@
import { SignaturePair } from '@/data/proto/3_3/SignaturePair'
import { AbstractLoggingView } from './AbstractLogging.view'
export class SignaturePairLoggingView extends AbstractLoggingView {
public constructor(private self: SignaturePair) {
super()
}
// eslint-disable-next-line @typescript-eslint/no-explicit-any
public toJSON(): any {
return {
pubkey: Buffer.from(this.self.pubKey).toString(this.bufferStringFormat),
signature:
Buffer.from(this.self.signature).subarray(0, 31).toString(this.bufferStringFormat) + '..',
}
}
}

View File

@ -0,0 +1,46 @@
import { CrossGroupType } from '@/data/proto/3_3/enum/CrossGroupType'
import { TransactionBody } from '@/data/proto/3_3/TransactionBody'
import { getEnumValue } from '@/utils/typeConverter'
import { AbstractLoggingView } from './AbstractLogging.view'
import { CommunityRootLoggingView } from './CommunityRootLogging.view'
import { GradidoCreationLoggingView } from './GradidoCreationLogging.view'
import { GradidoDeferredTransferLoggingView } from './GradidoDeferredTransferLogging.view'
import { GradidoTransferLoggingView } from './GradidoTransferLogging.view'
import { GroupFriendsUpdateLoggingView } from './GroupFriendsUpdateLogging.view'
import { RegisterAddressLoggingView } from './RegisterAddressLogging.view'
export class TransactionBodyLoggingView extends AbstractLoggingView {
public constructor(private self: TransactionBody) {
super()
}
// eslint-disable-next-line @typescript-eslint/no-explicit-any
public toJSON(): any {
return {
memo: this.self.memo,
createdAt: this.timestampToDateString(this.self.createdAt),
versionNumber: this.self.versionNumber,
type: getEnumValue(CrossGroupType, this.self.type),
otherGroup: this.self.otherGroup,
transfer: this.self.transfer
? new GradidoTransferLoggingView(this.self.transfer).toJSON()
: undefined,
creation: this.self.creation
? new GradidoCreationLoggingView(this.self.creation).toJSON()
: undefined,
groupFriendsUpdate: this.self.groupFriendsUpdate
? new GroupFriendsUpdateLoggingView(this.self.groupFriendsUpdate).toJSON()
: undefined,
registerAddress: this.self.registerAddress
? new RegisterAddressLoggingView(this.self.registerAddress).toJSON()
: undefined,
deferredTransfer: this.self.deferredTransfer
? new GradidoDeferredTransferLoggingView(this.self.deferredTransfer).toJSON()
: undefined,
communityRoot: this.self.communityRoot
? new CommunityRootLoggingView(this.self.communityRoot).toJSON()
: undefined,
}
}
}

View File

@ -0,0 +1,25 @@
import { InputTransactionType } from '@/graphql/enum/InputTransactionType'
import { TransactionDraft } from '@/graphql/input/TransactionDraft'
import { getEnumValue } from '@/utils/typeConverter'
import { AbstractLoggingView } from './AbstractLogging.view'
import { UserIdentifierLoggingView } from './UserIdentifierLogging.view'
export class TransactionDraftLoggingView extends AbstractLoggingView {
public constructor(private self: TransactionDraft) {
super()
}
// eslint-disable-next-line @typescript-eslint/no-explicit-any
public toJSON(): any {
return {
user: new UserIdentifierLoggingView(this.self.user).toJSON(),
linkedUser: new UserIdentifierLoggingView(this.self.linkedUser).toJSON(),
backendTransactionId: this.self.backendTransactionId,
amount: this.decimalToString(this.self.amount),
type: getEnumValue(InputTransactionType, this.self.type),
createdAt: this.self.createdAt,
targetDate: this.self.targetDate,
}
}
}

View File

@ -0,0 +1,59 @@
import { Transaction } from '@entity/Transaction'
import { TransactionType } from '@/data/proto/3_3/enum/TransactionType'
import { LogError } from '@/server/LogError'
import { getEnumValue } from '@/utils/typeConverter'
import { AbstractLoggingView } from './AbstractLogging.view'
import { AccountLoggingView } from './AccountLogging.view'
import { BackendTransactionLoggingView } from './BackendTransactionLogging.view'
import { CommunityLoggingView } from './CommunityLogging.view'
export class TransactionLoggingView extends AbstractLoggingView {
public constructor(private self: Transaction) {
super()
if (this.self.community === undefined) {
throw new LogError('sender community is zero')
}
}
// eslint-disable-next-line @typescript-eslint/no-explicit-any
public toJSON(showBackendTransactions = true): any {
return {
id: this.self.id,
nr: this.self.nr,
bodyBytesLength: this.self.bodyBytes.length,
createdAt: this.dateToString(this.self.createdAt),
confirmedAt: this.dateToString(this.self.confirmedAt),
protocolVersion: this.self.protocolVersion,
type: getEnumValue(TransactionType, this.self.type),
signature: this.self.signature.subarray(0, 31).toString(this.bufferStringFormat) + '..',
community: new CommunityLoggingView(this.self.community).toJSON(),
otherCommunity: this.self.otherCommunity
? new CommunityLoggingView(this.self.otherCommunity)
: undefined,
iotaMessageId: this.self.iotaMessageId
? this.self.iotaMessageId.toString(this.bufferStringFormat)
: undefined,
signingAccount: this.self.signingAccount
? new AccountLoggingView(this.self.signingAccount)
: undefined,
recipientAccount: this.self.recipientAccount
? new AccountLoggingView(this.self.recipientAccount)
: undefined,
amount: this.decimalToString(this.self.amount),
accountBalanceOnCreation: this.decimalToString(this.self.accountBalanceOnCreation),
accountBalanceOnConfirmation: this.decimalToString(this.self.accountBalanceOnConfirmation),
runningHash: this.self.runningHash
? this.self.runningHash.toString(this.bufferStringFormat)
: undefined,
iotaMilestone: this.self.iotaMilestone,
backendTransactions:
showBackendTransactions && this.self.backendTransactions
? this.self.backendTransactions.map((backendTransaction) =>
new BackendTransactionLoggingView(backendTransaction).toJSON(false),
)
: undefined,
}
}
}

View File

@ -0,0 +1,18 @@
import { TransferAmount } from '@/data/proto/3_3/TransferAmount'
import { AbstractLoggingView } from './AbstractLogging.view'
export class TransferAmountLoggingView extends AbstractLoggingView {
public constructor(private self: TransferAmount) {
super()
}
// eslint-disable-next-line @typescript-eslint/no-explicit-any
public toJSON(): any {
return {
publicKey: Buffer.from(this.self.pubkey).toString(this.bufferStringFormat),
amount: this.self.amount,
communityId: this.self.communityId,
}
}
}

View File

@ -0,0 +1,18 @@
import { UserIdentifier } from '@/graphql/input/UserIdentifier'
import { AbstractLoggingView } from './AbstractLogging.view'
export class UserIdentifierLoggingView extends AbstractLoggingView {
public constructor(private self: UserIdentifier) {
super()
}
// eslint-disable-next-line @typescript-eslint/no-explicit-any
public toJSON(): any {
return {
uuid: this.self.uuid,
communityUuid: this.self.communityUuid,
accountNr: this.self.accountNr,
}
}
}

View File

@ -0,0 +1,20 @@
import { User } from '@entity/User'
import { AbstractLoggingView } from './AbstractLogging.view'
export class UserLoggingView extends AbstractLoggingView {
public constructor(private user: User) {
super()
}
// eslint-disable-next-line @typescript-eslint/no-explicit-any
public toJSON(): any {
return {
id: this.user.id,
gradidoId: this.user.gradidoID,
derive1Pubkey: this.user.derive1Pubkey.toString(this.bufferStringFormat),
createdAt: this.dateToString(this.user.createdAt),
confirmedAt: this.dateToString(this.user.confirmedAt),
}
}
}

View File

@ -1,5 +1,5 @@
/* eslint-disable @typescript-eslint/no-unsafe-argument */
import { logger } from './logger'
import { logger } from '@/logging/logger'
export class LogError extends Error {
// eslint-disable-next-line @typescript-eslint/no-explicit-any

View File

@ -9,10 +9,9 @@ import express, { Express } from 'express'
import { Logger } from 'log4js'
import { schema } from '@/graphql/schema'
import { logger as dltLogger } from '@/logging/logger'
import { Connection } from '@/typeorm/DataSource'
import { logger as dltLogger } from './logger'
type ServerDef = { apollo: ApolloServer; app: Express }
interface MyContext {

View File

@ -5,8 +5,8 @@ import { entities } from '@entity/index'
import { Migration } from '@entity/Migration'
import { CONFIG } from '@/config'
import { logger } from '@/logging/logger'
import { LogError } from '@/server/LogError'
import { logger } from '@/server/logger'
// eslint-disable-next-line @typescript-eslint/no-extraneous-class
export class Connection {

View File

@ -7,8 +7,8 @@ import { TransactionBody } from '@/data/proto/3_3/TransactionBody'
import { AccountType } from '@/graphql/enum/AccountType'
import { TransactionErrorType } from '@/graphql/enum/TransactionErrorType'
import { TransactionError } from '@/graphql/model/TransactionError'
import { logger } from '@/logging/logger'
import { LogError } from '@/server/LogError'
import { logger } from '@/server/logger'
export const uuid4ToBuffer = (uuid: string): Buffer => {
// Remove dashes from the UUIDv4 string

View File

@ -1,9 +1,9 @@
import { logger } from '@/server/logger'
import { logger } from '@/logging/logger'
jest.setTimeout(1000000)
jest.mock('@/server/logger', () => {
const originalModule = jest.requireActual('@/server/logger')
jest.mock('@/logging/logger', () => {
const originalModule = jest.requireActual('@/logging/logger')
return {
__esModule: true,
...originalModule,