mirror of
https://github.com/IT4Change/gradido.git
synced 2026-02-06 09:56:05 +00:00
add decayLoggingView use in balanceResolver.balance to compress log output
This commit is contained in:
parent
43b0ac4511
commit
91435656e0
@ -15,6 +15,7 @@ import { calculateDecay } from '@/util/decay'
|
||||
import { GdtResolver } from './GdtResolver'
|
||||
import { getLastTransaction } from './util/getLastTransaction'
|
||||
import { transactionLinkSummary } from './util/transactionLinkSummary'
|
||||
import { DecayLoggingView } from '@/logging/DecayLogging.view'
|
||||
|
||||
@Resolver()
|
||||
export class BalanceResolver {
|
||||
@ -85,9 +86,9 @@ export class BalanceResolver {
|
||||
)
|
||||
logger.info(
|
||||
'calculatedDecay',
|
||||
lastTransaction.balance,
|
||||
lastTransaction.balanceDate,
|
||||
calculatedDecay,
|
||||
lastTransaction.balance.toString(),
|
||||
lastTransaction.balanceDate.toISOString(),
|
||||
new DecayLoggingView(calculatedDecay),
|
||||
)
|
||||
|
||||
// The final balance is reduced by the link amount withheld
|
||||
@ -115,7 +116,7 @@ export class BalanceResolver {
|
||||
count,
|
||||
linkCount,
|
||||
})
|
||||
logger.info('new Balance', balance, balanceGDT, count, linkCount, newBalance)
|
||||
logger.info('new Balance', balance.toString(), balanceGDT?.toString(), count, linkCount, newBalance.toString())
|
||||
|
||||
return newBalance
|
||||
}
|
||||
|
||||
20
backend/src/logging/DecayLogging.view.ts
Normal file
20
backend/src/logging/DecayLogging.view.ts
Normal file
@ -0,0 +1,20 @@
|
||||
import { Decay } from '@/graphql/model/Decay'
|
||||
import { AbstractLoggingView } from '@logging/AbstractLogging.view'
|
||||
|
||||
export class DecayLoggingView extends AbstractLoggingView {
|
||||
public constructor(private self: Decay) {
|
||||
super()
|
||||
}
|
||||
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||
public toJSON(): any {
|
||||
return {
|
||||
balance: this.decimalToString(this.self.balance),
|
||||
decay: this.decimalToString(this.self.decay),
|
||||
roundedDecay: this.decimalToString(this.self.roundedDecay),
|
||||
start: this.dateToString(this.self.start),
|
||||
end: this.dateToString(this.self.end),
|
||||
duration: this.self.duration
|
||||
}
|
||||
}
|
||||
}
|
||||
Loading…
x
Reference in New Issue
Block a user