logging
This commit is contained in:
parent
c0e6b6d0f6
commit
8929086ebf
@ -56,6 +56,21 @@ function writeNodeLog(
|
|||||||
export class Logger {
|
export class Logger {
|
||||||
constructor(private tag: string) {}
|
constructor(private tag: string) {}
|
||||||
|
|
||||||
|
shouldLogTrace() {
|
||||||
|
// FIXME: Implement logic to check loglevel
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
shouldLogInfo() {
|
||||||
|
// FIXME: Implement logic to check loglevel
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
shouldLogWarn() {
|
||||||
|
// FIXME: Implement logic to check loglevel
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
info(message: string, ...args: any[]): void {
|
info(message: string, ...args: any[]): void {
|
||||||
if (isNode) {
|
if (isNode) {
|
||||||
writeNodeLog(message, this.tag, "INFO", args);
|
writeNodeLog(message, this.tag, "INFO", args);
|
||||||
|
@ -31,6 +31,7 @@ import {
|
|||||||
NotificationType,
|
NotificationType,
|
||||||
RefreshGroupId,
|
RefreshGroupId,
|
||||||
RefreshReason,
|
RefreshReason,
|
||||||
|
stringifyTimestamp,
|
||||||
TalerErrorDetails,
|
TalerErrorDetails,
|
||||||
timestampToIsoString,
|
timestampToIsoString,
|
||||||
} from "@gnu-taler/taler-util";
|
} from "@gnu-taler/taler-util";
|
||||||
@ -147,6 +148,8 @@ async function refreshCreateSession(
|
|||||||
throw Error("db inconsistent: exchange of coin not found");
|
throw Error("db inconsistent: exchange of coin not found");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// FIXME: use helper functions from withdraw.ts
|
||||||
|
// to update and filter withdrawable denoms.
|
||||||
|
|
||||||
const { availableAmount, availableDenoms } = await ws.db
|
const { availableAmount, availableDenoms } = await ws.db
|
||||||
.mktx((x) => ({
|
.mktx((x) => ({
|
||||||
@ -179,6 +182,19 @@ async function refreshCreateSession(
|
|||||||
availableDenoms,
|
availableDenoms,
|
||||||
);
|
);
|
||||||
|
|
||||||
|
if (logger.shouldLogTrace()) {
|
||||||
|
logger.trace(`printing selected denominations for refresh`);
|
||||||
|
logger.trace(`current time: ${stringifyTimestamp(getTimestampNow())}`);
|
||||||
|
for (const denom of newCoinDenoms.selectedDenoms) {
|
||||||
|
console.log(`denom ${denom.denom}, count ${denom.count}`);
|
||||||
|
console.log(
|
||||||
|
`withdrawal expiration ${stringifyTimestamp(
|
||||||
|
denom.denom.stampExpireWithdraw,
|
||||||
|
)}`,
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (newCoinDenoms.selectedDenoms.length === 0) {
|
if (newCoinDenoms.selectedDenoms.length === 0) {
|
||||||
logger.trace(
|
logger.trace(
|
||||||
`not refreshing, available amount ${amountToPretty(
|
`not refreshing, available amount ${amountToPretty(
|
||||||
|
Loading…
Reference in New Issue
Block a user