add logging

This commit is contained in:
sneurlax 2024-02-15 17:14:01 -06:00
parent 3d942f3e0b
commit d00c205e6c
2 changed files with 8 additions and 6 deletions

View file

@ -47,13 +47,13 @@ class CachedElectrumXClient {
/// If the client is closed, use the callback to update it. /// If the client is closed, use the callback to update it.
_checkElectrumAdapterClient() async { _checkElectrumAdapterClient() async {
if (electrumAdapterClient.peer.isClosed) { if (electrumAdapterClient.peer.isClosed) {
Logging.instance.log(
"ElectrumAdapterClient is closed, reopening it...",
level: LogLevel.Info,
);
ElectrumClient? _electrumAdapterClient = ElectrumClient? _electrumAdapterClient =
await electrumAdapterUpdateCallback?.call(); await electrumAdapterUpdateCallback.call();
if (_electrumAdapterClient != null) { electrumAdapterClient = _electrumAdapterClient;
electrumAdapterClient = _electrumAdapterClient;
} else {
throw Exception("ElectrumAdapterClient is closed");
}
} }
} }

View file

@ -1296,6 +1296,8 @@ mixin ElectrumXInterface<T extends Bip39HDCurrency> on Bip39HDWallet<T> {
} }
Future<ElectrumClient> updateClient() async { Future<ElectrumClient> updateClient() async {
Logging.instance.log("Updating electrum node and ElectrumAdapterClient.",
level: LogLevel.Info);
await updateNode(); await updateNode();
return electrumAdapterClient; return electrumAdapterClient;
} }