summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFlorian Dold <florian.dold@gmail.com>2020-07-24 00:25:49 +0530
committerFlorian Dold <florian.dold@gmail.com>2020-07-24 00:25:49 +0530
commit2208d3c4a0a05d33c51e1e91f5af296fc9d0f8eb (patch)
tree97aebe09bfe416603a69010ef0fa0fd39a131dce
parent5b8924b8cfe14909b778ec096b3d893a9dde8533 (diff)
downloadwallet-core-2208d3c4a0a05d33c51e1e91f5af296fc9d0f8eb.tar.gz
wallet-core-2208d3c4a0a05d33c51e1e91f5af296fc9d0f8eb.tar.bz2
wallet-core-2208d3c4a0a05d33c51e1e91f5af296fc9d0f8eb.zip
logging
-rw-r--r--src/crypto/workers/cryptoApi.ts17
1 files changed, 5 insertions, 12 deletions
diff --git a/src/crypto/workers/cryptoApi.ts b/src/crypto/workers/cryptoApi.ts
index 14964e4d8..5e922ec02 100644
--- a/src/crypto/workers/cryptoApi.ts
+++ b/src/crypto/workers/cryptoApi.ts
@@ -45,6 +45,9 @@ import {
} from "../../types/walletTypes";
import * as timer from "../../util/timer";
+import { Logger } from "../../util/logging";
+
+const logger = new Logger("cryptoApi.ts");
/**
* State of a crypto worker.
@@ -144,15 +147,13 @@ export class CryptoApi {
*/
private stopped = false;
- static enableTracing = false;
-
/**
* Terminate all worker threads.
*/
terminateWorkers(): void {
for (const worker of this.workers) {
if (worker.w) {
- CryptoApi.enableTracing && console.log("terminating worker");
+ logger.trace("terminating worker");
worker.w.terminate();
if (worker.terminationTimerHandle) {
worker.terminationTimerHandle.clear();
@@ -177,9 +178,7 @@ export class CryptoApi {
*/
wake(ws: WorkerState, work: WorkItem): void {
if (this.stopped) {
- console.log("cryptoApi is stopped");
- CryptoApi.enableTracing &&
- console.log("not waking, as cryptoApi is stopped");
+ logger.trace("cryptoApi is stopped");
return;
}
if (ws.currentWorkItem !== null) {
@@ -282,12 +281,6 @@ export class CryptoApi {
return;
}
- CryptoApi.enableTracing &&
- console.log(
- `rpc ${currentWorkItem.operation} took ${
- timer.performanceNow() - currentWorkItem.startTime
- }ms`,
- );
currentWorkItem.resolve(msg.data.result);
}