moving logger into taler-util
This commit is contained in:
parent
2c5612fd63
commit
2e1438eb04
@ -32,9 +32,9 @@ import {
|
|||||||
addPaytoQueryParams,
|
addPaytoQueryParams,
|
||||||
codecForList,
|
codecForList,
|
||||||
codecForString,
|
codecForString,
|
||||||
|
Logger,
|
||||||
} from "@gnu-taler/taler-util";
|
} from "@gnu-taler/taler-util";
|
||||||
import {
|
import {
|
||||||
Logger,
|
|
||||||
Wallet,
|
Wallet,
|
||||||
NodeHttpLib,
|
NodeHttpLib,
|
||||||
getDefaultNodeWallet,
|
getDefaultNodeWallet,
|
||||||
|
@ -37,7 +37,7 @@ import {
|
|||||||
} from "@gnu-taler/taler-util";
|
} from "@gnu-taler/taler-util";
|
||||||
|
|
||||||
import * as timer from "../../util/timer";
|
import * as timer from "../../util/timer";
|
||||||
import { Logger } from "../../util/logging";
|
import { Logger } from "@gnu-taler/taler-util";
|
||||||
import {
|
import {
|
||||||
DerivedRefreshSession,
|
DerivedRefreshSession,
|
||||||
DerivedTipPlanchet,
|
DerivedTipPlanchet,
|
||||||
|
@ -68,7 +68,7 @@ import { randomBytes } from "../primitives/nacl-fast";
|
|||||||
import { kdf } from "../primitives/kdf";
|
import { kdf } from "../primitives/kdf";
|
||||||
import { Timestamp, timestampTruncateToSecond } from "@gnu-taler/taler-util";
|
import { Timestamp, timestampTruncateToSecond } from "@gnu-taler/taler-util";
|
||||||
|
|
||||||
import { Logger } from "../../util/logging";
|
import { Logger } from "@gnu-taler/taler-util";
|
||||||
import {
|
import {
|
||||||
DerivedRefreshSession,
|
DerivedRefreshSession,
|
||||||
DerivedTipPlanchet,
|
DerivedTipPlanchet,
|
||||||
|
@ -21,7 +21,7 @@ import { CryptoWorkerFactory } from "./cryptoApi";
|
|||||||
import { CryptoWorker } from "./cryptoWorker";
|
import { CryptoWorker } from "./cryptoWorker";
|
||||||
import os from "os";
|
import os from "os";
|
||||||
import { CryptoImplementation } from "./cryptoImplementation";
|
import { CryptoImplementation } from "./cryptoImplementation";
|
||||||
import { Logger } from "../../util/logging";
|
import { Logger } from "@gnu-taler/taler-util";
|
||||||
|
|
||||||
const logger = new Logger("nodeThreadWorker.ts");
|
const logger = new Logger("nodeThreadWorker.ts");
|
||||||
|
|
||||||
|
@ -12,7 +12,7 @@ import {
|
|||||||
IDBTransaction,
|
IDBTransaction,
|
||||||
IDBKeyPath,
|
IDBKeyPath,
|
||||||
} from "@gnu-taler/idb-bridge";
|
} from "@gnu-taler/idb-bridge";
|
||||||
import { Logger } from "./util/logging";
|
import { Logger } from "@gnu-taler/taler-util";
|
||||||
import {
|
import {
|
||||||
AmountJson,
|
AmountJson,
|
||||||
AmountString,
|
AmountString,
|
||||||
|
@ -29,7 +29,7 @@ import { RequestThrottler } from "../util/RequestThrottler";
|
|||||||
import Axios, { AxiosResponse } from "axios";
|
import Axios, { AxiosResponse } from "axios";
|
||||||
import { OperationFailedError, makeErrorDetails } from "../operations/errors";
|
import { OperationFailedError, makeErrorDetails } from "../operations/errors";
|
||||||
import { URL } from "../util/url";
|
import { URL } from "../util/url";
|
||||||
import { Logger } from "../util/logging";
|
import { Logger } from "@gnu-taler/taler-util";
|
||||||
import { bytesToString } from "../crypto/talerCrypto";
|
import { bytesToString } from "../crypto/talerCrypto";
|
||||||
import { TalerErrorCode } from "@gnu-taler/taler-util";
|
import { TalerErrorCode } from "@gnu-taler/taler-util";
|
||||||
|
|
||||||
|
@ -32,7 +32,7 @@ import { openTalerDatabase } from "../db";
|
|||||||
import { HttpRequestLibrary } from "../util/http";
|
import { HttpRequestLibrary } from "../util/http";
|
||||||
import { NodeThreadCryptoWorkerFactory } from "../crypto/workers/nodeThreadWorker";
|
import { NodeThreadCryptoWorkerFactory } from "../crypto/workers/nodeThreadWorker";
|
||||||
import { NodeHttpLib } from "./NodeHttpLib";
|
import { NodeHttpLib } from "./NodeHttpLib";
|
||||||
import { Logger } from "../util/logging";
|
import { Logger } from "@gnu-taler/taler-util";
|
||||||
import { SynchronousCryptoWorkerFactory } from "../crypto/workers/synchronousWorker";
|
import { SynchronousCryptoWorkerFactory } from "../crypto/workers/synchronousWorker";
|
||||||
import type { IDBFactory } from "@gnu-taler/idb-bridge";
|
import type { IDBFactory } from "@gnu-taler/idb-bridge";
|
||||||
import { WalletNotification } from "@gnu-taler/taler-util";
|
import { WalletNotification } from "@gnu-taler/taler-util";
|
||||||
|
@ -22,7 +22,6 @@
|
|||||||
export * from "./operations/errors";
|
export * from "./operations/errors";
|
||||||
|
|
||||||
// Util functionality
|
// Util functionality
|
||||||
export { Logger } from "./util/logging";
|
|
||||||
export { URL } from "./util/url";
|
export { URL } from "./util/url";
|
||||||
export * from "./util/promiseUtils";
|
export * from "./util/promiseUtils";
|
||||||
export * from "./util/query";
|
export * from "./util/query";
|
||||||
@ -39,9 +38,6 @@ export * from "./operations/versions";
|
|||||||
|
|
||||||
export * from "./db";
|
export * from "./db";
|
||||||
|
|
||||||
// Internationalization
|
|
||||||
export * from "./i18n";
|
|
||||||
|
|
||||||
// Crypto and crypto workers
|
// Crypto and crypto workers
|
||||||
export * from "./crypto/workers/nodeThreadWorker";
|
export * from "./crypto/workers/nodeThreadWorker";
|
||||||
export { CryptoImplementation } from "./crypto/workers/cryptoImplementation";
|
export { CryptoImplementation } from "./crypto/workers/cryptoImplementation";
|
||||||
|
@ -51,7 +51,7 @@ import { TransactionHandle } from "../../index.js";
|
|||||||
import { PayCoinSelection } from "../../util/coinSelection";
|
import { PayCoinSelection } from "../../util/coinSelection";
|
||||||
import { j2s } from "@gnu-taler/taler-util";
|
import { j2s } from "@gnu-taler/taler-util";
|
||||||
import { checkDbInvariant, checkLogicInvariant } from "../../util/invariants";
|
import { checkDbInvariant, checkLogicInvariant } from "../../util/invariants";
|
||||||
import { Logger } from "../../util/logging";
|
import { Logger } from "@gnu-taler/taler-util";
|
||||||
import { initRetryInfo } from "../../util/retries";
|
import { initRetryInfo } from "../../util/retries";
|
||||||
import { InternalWalletState } from "../state";
|
import { InternalWalletState } from "../state";
|
||||||
import { provideBackupState } from "./state";
|
import { provideBackupState } from "./state";
|
||||||
|
@ -70,7 +70,7 @@ import {
|
|||||||
readSuccessResponseJsonOrThrow,
|
readSuccessResponseJsonOrThrow,
|
||||||
readTalerErrorResponse,
|
readTalerErrorResponse,
|
||||||
} from "../../util/http";
|
} from "../../util/http";
|
||||||
import { Logger } from "../../util/logging";
|
import { Logger } from "@gnu-taler/taler-util";
|
||||||
import { gunzipSync, gzipSync } from "fflate";
|
import { gunzipSync, gzipSync } from "fflate";
|
||||||
import { kdf } from "../../crypto/primitives/kdf";
|
import { kdf } from "../../crypto/primitives/kdf";
|
||||||
import { initRetryInfo } from "../../util/retries";
|
import { initRetryInfo } from "../../util/retries";
|
||||||
|
@ -20,7 +20,7 @@
|
|||||||
import { AmountJson, BalancesResponse, Amounts } from "@gnu-taler/taler-util";
|
import { AmountJson, BalancesResponse, Amounts } from "@gnu-taler/taler-util";
|
||||||
import { Stores, CoinStatus } from "../db.js";
|
import { Stores, CoinStatus } from "../db.js";
|
||||||
import { TransactionHandle } from "../index.js";
|
import { TransactionHandle } from "../index.js";
|
||||||
import { Logger } from "../util/logging";
|
import { Logger } from "@gnu-taler/taler-util";
|
||||||
import { InternalWalletState } from "./state.js";
|
import { InternalWalletState } from "./state.js";
|
||||||
|
|
||||||
const logger = new Logger("withdraw.ts");
|
const logger = new Logger("withdraw.ts");
|
||||||
|
@ -18,7 +18,7 @@
|
|||||||
* Imports.
|
* Imports.
|
||||||
*/
|
*/
|
||||||
import { ExchangeRecord, Stores } from "../db.js";
|
import { ExchangeRecord, Stores } from "../db.js";
|
||||||
import { Logger } from "../util/logging";
|
import { Logger } from "@gnu-taler/taler-util";
|
||||||
import { getExchangeDetails } from "./exchanges.js";
|
import { getExchangeDetails } from "./exchanges.js";
|
||||||
import { InternalWalletState } from "./state.js";
|
import { InternalWalletState } from "./state.js";
|
||||||
|
|
||||||
|
@ -55,7 +55,7 @@ import {
|
|||||||
getTotalPaymentCost,
|
getTotalPaymentCost,
|
||||||
} from "./pay";
|
} from "./pay";
|
||||||
import { InternalWalletState } from "./state";
|
import { InternalWalletState } from "./state";
|
||||||
import { Logger } from "../util/logging.js";
|
import { Logger } from "@gnu-taler/taler-util";
|
||||||
import { DepositGroupRecord, Stores } from "../db.js";
|
import { DepositGroupRecord, Stores } from "../db.js";
|
||||||
import { guardOperationException } from "./errors.js";
|
import { guardOperationException } from "./errors.js";
|
||||||
import { getExchangeDetails } from "./exchanges.js";
|
import { getExchangeDetails } from "./exchanges.js";
|
||||||
|
@ -30,6 +30,7 @@ import {
|
|||||||
ExchangeWireJson,
|
ExchangeWireJson,
|
||||||
getTimestampNow,
|
getTimestampNow,
|
||||||
isTimestampExpired,
|
isTimestampExpired,
|
||||||
|
Logger,
|
||||||
NotificationType,
|
NotificationType,
|
||||||
parsePaytoUri,
|
parsePaytoUri,
|
||||||
Recoup,
|
Recoup,
|
||||||
@ -49,7 +50,6 @@ import {
|
|||||||
WireInfo,
|
WireInfo,
|
||||||
} from "../db.js";
|
} from "../db.js";
|
||||||
import {
|
import {
|
||||||
Logger,
|
|
||||||
URL,
|
URL,
|
||||||
readSuccessResponseJsonOrThrow,
|
readSuccessResponseJsonOrThrow,
|
||||||
getExpiryTimestamp,
|
getExpiryTimestamp,
|
||||||
|
@ -50,6 +50,7 @@ import {
|
|||||||
PreparePayResult,
|
PreparePayResult,
|
||||||
PreparePayResultType,
|
PreparePayResultType,
|
||||||
parsePayUri,
|
parsePayUri,
|
||||||
|
Logger,
|
||||||
} from "@gnu-taler/taler-util";
|
} from "@gnu-taler/taler-util";
|
||||||
import { encodeCrock, getRandomBytes } from "../crypto/talerCrypto";
|
import { encodeCrock, getRandomBytes } from "../crypto/talerCrypto";
|
||||||
import {
|
import {
|
||||||
@ -62,7 +63,6 @@ import {
|
|||||||
getHttpResponseErrorDetails,
|
getHttpResponseErrorDetails,
|
||||||
guardOperationException,
|
guardOperationException,
|
||||||
HttpResponseStatus,
|
HttpResponseStatus,
|
||||||
Logger,
|
|
||||||
makeErrorDetails,
|
makeErrorDetails,
|
||||||
OperationFailedAndReportedError,
|
OperationFailedAndReportedError,
|
||||||
OperationFailedError,
|
OperationFailedError,
|
||||||
|
@ -45,7 +45,7 @@ import {
|
|||||||
} from "../db.js";
|
} from "../db.js";
|
||||||
|
|
||||||
import { readSuccessResponseJsonOrThrow } from "../util/http";
|
import { readSuccessResponseJsonOrThrow } from "../util/http";
|
||||||
import { Logger } from "../util/logging";
|
import { Logger } from "@gnu-taler/taler-util";
|
||||||
import { TransactionHandle } from "../util/query";
|
import { TransactionHandle } from "../util/query";
|
||||||
import { initRetryInfo, updateRetryInfoTimeout } from "../util/retries";
|
import { initRetryInfo, updateRetryInfoTimeout } from "../util/retries";
|
||||||
import { URL } from "../util/url";
|
import { URL } from "../util/url";
|
||||||
|
@ -37,7 +37,7 @@ import { AmountJson, Amounts } from "@gnu-taler/taler-util";
|
|||||||
import { amountToPretty } from "@gnu-taler/taler-util";
|
import { amountToPretty } from "@gnu-taler/taler-util";
|
||||||
import { readSuccessResponseJsonOrThrow } from "../util/http";
|
import { readSuccessResponseJsonOrThrow } from "../util/http";
|
||||||
import { checkDbInvariant } from "../util/invariants";
|
import { checkDbInvariant } from "../util/invariants";
|
||||||
import { Logger } from "../util/logging";
|
import { Logger } from "@gnu-taler/taler-util";
|
||||||
import { TransactionHandle } from "../util/query";
|
import { TransactionHandle } from "../util/query";
|
||||||
import { initRetryInfo, updateRetryInfoTimeout } from "../util/retries";
|
import { initRetryInfo, updateRetryInfoTimeout } from "../util/retries";
|
||||||
import {
|
import {
|
||||||
|
@ -46,7 +46,7 @@ import {
|
|||||||
parseRefundUri,
|
parseRefundUri,
|
||||||
RefreshReason,
|
RefreshReason,
|
||||||
} from "@gnu-taler/taler-util";
|
} from "@gnu-taler/taler-util";
|
||||||
import { Logger } from "../util/logging";
|
import { Logger } from "@gnu-taler/taler-util";
|
||||||
import { readSuccessResponseJsonOrThrow } from "../util/http";
|
import { readSuccessResponseJsonOrThrow } from "../util/http";
|
||||||
import { TransactionHandle } from "../util/query";
|
import { TransactionHandle } from "../util/query";
|
||||||
import { URL } from "../util/url";
|
import { URL } from "../util/url";
|
||||||
|
@ -64,7 +64,7 @@ import {
|
|||||||
} from "./withdraw.js";
|
} from "./withdraw.js";
|
||||||
import { getExchangeTrust } from "./currencies.js";
|
import { getExchangeTrust } from "./currencies.js";
|
||||||
import { encodeCrock, getRandomBytes } from "../crypto/talerCrypto.js";
|
import { encodeCrock, getRandomBytes } from "../crypto/talerCrypto.js";
|
||||||
import { Logger } from "../util/logging.js";
|
import { Logger } from "@gnu-taler/taler-util";
|
||||||
import { readSuccessResponseJsonOrErrorCode, readSuccessResponseJsonOrThrow, throwUnexpectedRequestError } from "../util/http.js";
|
import { readSuccessResponseJsonOrErrorCode, readSuccessResponseJsonOrThrow, throwUnexpectedRequestError } from "../util/http.js";
|
||||||
import { URL } from "../util/url.js";
|
import { URL } from "../util/url.js";
|
||||||
import { TransactionHandle } from "../util/query.js";
|
import { TransactionHandle } from "../util/query.js";
|
||||||
|
@ -17,9 +17,9 @@
|
|||||||
/**
|
/**
|
||||||
* Imports.
|
* Imports.
|
||||||
*/
|
*/
|
||||||
import { WalletNotification, BalancesResponse } from "@gnu-taler/taler-util";
|
import { WalletNotification, BalancesResponse, Logger } from "@gnu-taler/taler-util";
|
||||||
import { Stores } from "../db.js";
|
import { Stores } from "../db.js";
|
||||||
import { Logger, CryptoApi, OpenedPromise, Database, CryptoWorkerFactory, openPromise } from "../index.js";
|
import { CryptoApi, OpenedPromise, Database, CryptoWorkerFactory, openPromise } from "../index.js";
|
||||||
import { PendingOperationsResponse } from "../pending-types.js";
|
import { PendingOperationsResponse } from "../pending-types.js";
|
||||||
import { AsyncOpMemoMap, AsyncOpMemoSingle } from "../util/asyncMemo.js";
|
import { AsyncOpMemoMap, AsyncOpMemoSingle } from "../util/asyncMemo.js";
|
||||||
import { HttpRequestLibrary } from "../util/http";
|
import { HttpRequestLibrary } from "../util/http";
|
||||||
|
@ -17,7 +17,7 @@
|
|||||||
/**
|
/**
|
||||||
* Imports.
|
* Imports.
|
||||||
*/
|
*/
|
||||||
import { Logger } from "../util/logging";
|
import { Logger } from "@gnu-taler/taler-util";
|
||||||
import {
|
import {
|
||||||
HttpRequestLibrary,
|
HttpRequestLibrary,
|
||||||
readSuccessResponseJsonOrThrow,
|
readSuccessResponseJsonOrThrow,
|
||||||
|
@ -28,6 +28,7 @@ import {
|
|||||||
TipPlanchetDetail,
|
TipPlanchetDetail,
|
||||||
TalerErrorCode,
|
TalerErrorCode,
|
||||||
codecForTipResponse,
|
codecForTipResponse,
|
||||||
|
Logger,
|
||||||
} from "@gnu-taler/taler-util";
|
} from "@gnu-taler/taler-util";
|
||||||
import { DerivedTipPlanchet } from "../crypto/cryptoTypes.js";
|
import { DerivedTipPlanchet } from "../crypto/cryptoTypes.js";
|
||||||
import {
|
import {
|
||||||
@ -38,7 +39,6 @@ import {
|
|||||||
CoinStatus,
|
CoinStatus,
|
||||||
} from "../db.js";
|
} from "../db.js";
|
||||||
import {
|
import {
|
||||||
Logger,
|
|
||||||
URL,
|
URL,
|
||||||
readSuccessResponseJsonOrThrow,
|
readSuccessResponseJsonOrThrow,
|
||||||
encodeCrock,
|
encodeCrock,
|
||||||
|
@ -50,7 +50,7 @@ import {
|
|||||||
codecForTalerConfigResponse,
|
codecForTalerConfigResponse,
|
||||||
} from "@gnu-taler/taler-util";
|
} from "@gnu-taler/taler-util";
|
||||||
import { InternalWalletState } from "./state";
|
import { InternalWalletState } from "./state";
|
||||||
import { Logger } from "../util/logging";
|
import { Logger } from "@gnu-taler/taler-util";
|
||||||
import { getExchangeDetails, updateExchangeFromUrl } from "./exchanges";
|
import { getExchangeDetails, updateExchangeFromUrl } from "./exchanges";
|
||||||
import {
|
import {
|
||||||
WALLET_EXCHANGE_PROTOCOL_VERSION,
|
WALLET_EXCHANGE_PROTOCOL_VERSION,
|
||||||
|
@ -25,9 +25,9 @@ import {
|
|||||||
getTimestampNow,
|
getTimestampNow,
|
||||||
timestampDifference,
|
timestampDifference,
|
||||||
timestampCmp,
|
timestampCmp,
|
||||||
|
Logger,
|
||||||
} from "@gnu-taler/taler-util";
|
} from "@gnu-taler/taler-util";
|
||||||
import { URL } from "./url";
|
import { URL } from "./url";
|
||||||
import { Logger } from "./logging";
|
|
||||||
|
|
||||||
const logger = new Logger("RequestThrottler.ts");
|
const logger = new Logger("RequestThrottler.ts");
|
||||||
|
|
||||||
|
@ -24,8 +24,7 @@
|
|||||||
* Imports.
|
* Imports.
|
||||||
*/
|
*/
|
||||||
import { AmountJson, AmountLike, Amounts } from "@gnu-taler/taler-util";
|
import { AmountJson, AmountLike, Amounts } from "@gnu-taler/taler-util";
|
||||||
import { strcmp } from "@gnu-taler/taler-util";
|
import { strcmp, Logger } from "@gnu-taler/taler-util";
|
||||||
import { Logger } from "./logging.js";
|
|
||||||
|
|
||||||
const logger = new Logger("coinSelection.ts");
|
const logger = new Logger("coinSelection.ts");
|
||||||
|
|
||||||
|
@ -25,8 +25,8 @@
|
|||||||
* Imports
|
* Imports
|
||||||
*/
|
*/
|
||||||
import { OperationFailedError, makeErrorDetails } from "../operations/errors";
|
import { OperationFailedError, makeErrorDetails } from "../operations/errors";
|
||||||
import { Logger } from "./logging";
|
|
||||||
import {
|
import {
|
||||||
|
Logger,
|
||||||
Duration,
|
Duration,
|
||||||
Timestamp,
|
Timestamp,
|
||||||
getTimestampNow,
|
getTimestampNow,
|
||||||
|
@ -1,100 +0,0 @@
|
|||||||
/*
|
|
||||||
This file is part of TALER
|
|
||||||
(C) 2019 GNUnet e.V.
|
|
||||||
|
|
||||||
TALER is free software; you can redistribute it and/or modify it under the
|
|
||||||
terms of the GNU General Public License as published by the Free Software
|
|
||||||
Foundation; either version 3, or (at your option) any later version.
|
|
||||||
|
|
||||||
TALER is distributed in the hope that it will be useful, but WITHOUT ANY
|
|
||||||
WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
|
|
||||||
A PARTICULAR PURPOSE. See the GNU General Public License for more details.
|
|
||||||
|
|
||||||
You should have received a copy of the GNU General Public License along with
|
|
||||||
TALER; see the file COPYING. If not, see <http://www.gnu.org/licenses/>
|
|
||||||
*/
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Check if we are running under nodejs.
|
|
||||||
*/
|
|
||||||
|
|
||||||
const isNode =
|
|
||||||
typeof process !== "undefined" && typeof process.release !== "undefined" && process.release.name === "node";
|
|
||||||
|
|
||||||
function writeNodeLog(
|
|
||||||
message: any,
|
|
||||||
tag: string,
|
|
||||||
level: string,
|
|
||||||
args: any[],
|
|
||||||
): void {
|
|
||||||
try {
|
|
||||||
process.stderr.write(`${new Date().toISOString()} ${tag} ${level} `);
|
|
||||||
process.stderr.write(`${message}`);
|
|
||||||
if (args.length != 0) {
|
|
||||||
process.stderr.write(" ");
|
|
||||||
process.stderr.write(JSON.stringify(args, undefined, 2));
|
|
||||||
}
|
|
||||||
process.stderr.write("\n");
|
|
||||||
} catch (e) {
|
|
||||||
// This can happen when we're trying to log something that doesn't want to be
|
|
||||||
// converted to a string.
|
|
||||||
process.stderr.write(`${new Date().toISOString()} (logger) FATAL `);
|
|
||||||
if (e instanceof Error) {
|
|
||||||
process.stderr.write("failed to write log: ");
|
|
||||||
process.stderr.write(e.message);
|
|
||||||
}
|
|
||||||
process.stderr.write("\n");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Logger that writes to stderr when running under node,
|
|
||||||
* and uses the corresponding console.* method to log in the browser.
|
|
||||||
*/
|
|
||||||
export class Logger {
|
|
||||||
constructor(private tag: string) {}
|
|
||||||
|
|
||||||
info(message: string, ...args: any[]): void {
|
|
||||||
if (isNode) {
|
|
||||||
writeNodeLog(message, this.tag, "INFO", args);
|
|
||||||
} else {
|
|
||||||
console.info(
|
|
||||||
`${new Date().toISOString()} ${this.tag} INFO ` + message,
|
|
||||||
...args,
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
warn(message: string, ...args: any[]): void {
|
|
||||||
if (isNode) {
|
|
||||||
writeNodeLog(message, this.tag, "WARN", args);
|
|
||||||
} else {
|
|
||||||
console.warn(
|
|
||||||
`${new Date().toISOString()} ${this.tag} INFO ` + message,
|
|
||||||
...args,
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
error(message: string, ...args: any[]): void {
|
|
||||||
if (isNode) {
|
|
||||||
writeNodeLog(message, this.tag, "ERROR", args);
|
|
||||||
} else {
|
|
||||||
console.info(
|
|
||||||
`${new Date().toISOString()} ${this.tag} ERROR ` + message,
|
|
||||||
...args,
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
trace(message: any, ...args: any[]): void {
|
|
||||||
if (isNode) {
|
|
||||||
writeNodeLog(message, this.tag, "TRACE", args);
|
|
||||||
} else {
|
|
||||||
console.info(
|
|
||||||
`${new Date().toISOString()} ${this.tag} TRACE ` + message,
|
|
||||||
...args,
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
@ -33,9 +33,8 @@ import {
|
|||||||
IDBVersionChangeEvent,
|
IDBVersionChangeEvent,
|
||||||
Event,
|
Event,
|
||||||
IDBCursor,
|
IDBCursor,
|
||||||
IDBKeyPath,
|
|
||||||
} from "@gnu-taler/idb-bridge";
|
} from "@gnu-taler/idb-bridge";
|
||||||
import { Logger } from "./logging";
|
import { Logger } from "@gnu-taler/taler-util";
|
||||||
|
|
||||||
const logger = new Logger("query.ts");
|
const logger = new Logger("query.ts");
|
||||||
|
|
||||||
|
@ -24,8 +24,7 @@
|
|||||||
/**
|
/**
|
||||||
* Imports.
|
* Imports.
|
||||||
*/
|
*/
|
||||||
import { Duration } from "@gnu-taler/taler-util";
|
import { Logger, Duration } from "@gnu-taler/taler-util";
|
||||||
import { Logger } from "./logging";
|
|
||||||
|
|
||||||
const logger = new Logger("timer.ts");
|
const logger = new Logger("timer.ts");
|
||||||
|
|
||||||
|
@ -177,7 +177,7 @@ import { AmountJson, Amounts } from "@gnu-taler/taler-util";
|
|||||||
import { assertUnreachable } from "./util/assertUnreachable";
|
import { assertUnreachable } from "./util/assertUnreachable";
|
||||||
import { AsyncOpMemoSingle } from "./util/asyncMemo";
|
import { AsyncOpMemoSingle } from "./util/asyncMemo";
|
||||||
import { HttpRequestLibrary } from "./util/http";
|
import { HttpRequestLibrary } from "./util/http";
|
||||||
import { Logger } from "./util/logging";
|
import { Logger } from "@gnu-taler/taler-util";
|
||||||
import { AsyncCondition } from "./util/promiseUtils";
|
import { AsyncCondition } from "./util/promiseUtils";
|
||||||
import { Database } from "./util/query";
|
import { Database } from "./util/query";
|
||||||
import { Duration, durationMin } from "@gnu-taler/taler-util";
|
import { Duration, durationMin } from "@gnu-taler/taler-util";
|
||||||
|
@ -19,13 +19,12 @@
|
|||||||
*/
|
*/
|
||||||
import {
|
import {
|
||||||
OperationFailedError,
|
OperationFailedError,
|
||||||
Logger,
|
|
||||||
HttpRequestLibrary,
|
HttpRequestLibrary,
|
||||||
HttpRequestOptions,
|
HttpRequestOptions,
|
||||||
HttpResponse,
|
HttpResponse,
|
||||||
Headers,
|
Headers,
|
||||||
} from "@gnu-taler/taler-wallet-core";
|
} from "@gnu-taler/taler-wallet-core";
|
||||||
import { TalerErrorCode } from "@gnu-taler/taler-util";
|
import { Logger, TalerErrorCode } from "@gnu-taler/taler-util";
|
||||||
|
|
||||||
const logger = new Logger("browserHttpLib");
|
const logger = new Logger("browserHttpLib");
|
||||||
|
|
||||||
|
@ -22,7 +22,8 @@
|
|||||||
* Imports.
|
* Imports.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import { CryptoImplementation, Logger } from "@gnu-taler/taler-wallet-core";
|
import { Logger } from "@gnu-taler/taler-util";
|
||||||
|
import { CryptoImplementation } from "@gnu-taler/taler-wallet-core";
|
||||||
|
|
||||||
const logger = new Logger("browserWorkerEntry.ts");
|
const logger = new Logger("browserWorkerEntry.ts");
|
||||||
|
|
||||||
|
@ -21,7 +21,8 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
import { render } from "preact";
|
import { render } from "preact";
|
||||||
import { setupI18n } from "@gnu-taler/taler-wallet-core";
|
import { setupI18n } from "@gnu-taler/taler-util";
|
||||||
|
import { strings } from "./i18n"
|
||||||
import { Application } from './Application';
|
import { Application } from './Application';
|
||||||
|
|
||||||
function main(): void {
|
function main(): void {
|
||||||
@ -37,7 +38,7 @@ function main(): void {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
setupI18n("en-US");
|
setupI18n("en-US", strings);
|
||||||
|
|
||||||
if (document.readyState === "loading") {
|
if (document.readyState === "loading") {
|
||||||
document.addEventListener("DOMContentLoaded", main);
|
document.addEventListener("DOMContentLoaded", main);
|
||||||
|
Loading…
Reference in New Issue
Block a user