Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 5 additions & 7 deletions lib/db/db_version_migration.dart
Original file line number Diff line number Diff line change
Expand Up @@ -45,10 +45,7 @@ class DbVersionMigrator with WalletDB {
// safe to skip to v11 for campfire
fromVersion = 11;
}
Logging.instance.logd(
"Running migrate fromVersion $fromVersion",
level: LogLevel.Warning,
);
Logging.instance.i("Running migrate fromVersion $fromVersion");
switch (fromVersion) {
case 0:
await DB.instance.hive.openBox<dynamic>(DB.boxNameAllWalletsData);
Expand Down Expand Up @@ -102,12 +99,13 @@ class DbVersionMigrator with WalletDB {

try {
latestSetId = await client.getLelantusLatestCoinId();
} catch (e) {
} catch (e, s) {
// default to 2 for now
latestSetId = 2;
Logging.instance.logd(
Logging.instance.w(
"Failed to fetch latest coin id during firo db migrate: $e \nUsing a default value of 2",
level: LogLevel.Warning,
error: e,
stackTrace: s,
);
}
}
Expand Down
7 changes: 4 additions & 3 deletions lib/db/hive/db.dart
Original file line number Diff line number Diff line change
Expand Up @@ -166,9 +166,10 @@ class DB {
AppConfig.getCryptoCurrencyFor(jsonObject["coin"] as String);
return false;
} catch (e, s) {
Logging.instance.logd(
Logging.instance.e(
"Error, ${jsonObject["coin"]} does not exist, $name wallet cannot be loaded",
level: LogLevel.Error,
error: e,
stackTrace: s,
);
return true;
}
Expand Down Expand Up @@ -343,7 +344,7 @@ class DB {
await DB.instance.deleteBoxFromDisk(boxName: "theme");
return true;
} catch (e, s) {
Logging.instance.logd("$e $s", level: LogLevel.Error);
Logging.instance.e("$e $s", error: e, stackTrace: s);
return false;
}
}
Expand Down
14 changes: 2 additions & 12 deletions lib/db/sqlite/firo_cache.dart
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ import 'dart:async';
import 'dart:io';
import 'dart:isolate';

import 'package:flutter/foundation.dart';
import 'package:flutter_libsparkmobile/flutter_libsparkmobile.dart';
import 'package:mutex/mutex.dart';
import 'package:sqlite3/sqlite3.dart';
Expand All @@ -20,16 +19,6 @@ part 'firo_cache_reader.dart';
part 'firo_cache_worker.dart';
part 'firo_cache_writer.dart';

/// Temporary debugging log function for this file
void _debugLog(Object? object) {
if (kDebugMode) {
Logging.instance.logd(
object,
level: LogLevel.Debug,
);
}
}

abstract class _FiroCache {
static const int _setCacheVersion = 2;
static const int _tagsCacheVersion = 2;
Expand Down Expand Up @@ -116,7 +105,8 @@ abstract class _FiroCache {
VACUUM;
""",
);
_debugLog(

Logging.instance.d(
"_deleteAllCache() "
"duration = ${DateTime.now().difference(start)}",
);
Expand Down
15 changes: 3 additions & 12 deletions lib/db/sqlite/firo_cache_coordinator.dart
Original file line number Diff line number Diff line change
Expand Up @@ -42,14 +42,8 @@ abstract class FiroCacheCoordinator {
? await usedTagsCacheFile.length()
: 0;

Logging.instance.logd(
"Spark cache used tags size: $tagsSize",
level: LogLevel.Debug,
);
Logging.instance.logd(
"Spark cache anon set size: $setSize",
level: LogLevel.Debug,
);
Logging.instance.d("Spark cache used tags size: $tagsSize");
Logging.instance.d("Spark cache anon set size: $setSize");

final int bytes = tagsSize + setSize;

Expand Down Expand Up @@ -111,10 +105,7 @@ abstract class FiroCacheCoordinator {
progressUpdated?.call(prevSize, meta.size);

if (prevMeta?.blockHash == meta.blockHash) {
Logging.instance.logd(
"prevMeta?.blockHash == meta.blockHash",
level: LogLevel.Debug,
);
Logging.instance.d("prevMeta?.blockHash == meta.blockHash");
return;
}

Expand Down
28 changes: 15 additions & 13 deletions lib/electrumx_rpc/cached_electrumx_client.dart
Original file line number Diff line number Diff line change
Expand Up @@ -100,17 +100,17 @@ class CachedElectrumXClient {
}
// save set to db
await box.put(groupId, set);
Logging.instance.logd(
Logging.instance.d(
"Updated current anonymity set for ${cryptoCurrency.identifier} with group ID $groupId",
level: LogLevel.Info,
);
}

return set;
} catch (e, s) {
Logging.instance.logd(
"Failed to process CachedElectrumX.getAnonymitySet(): $e\n$s",
level: LogLevel.Error,
Logging.instance.e(
"Failed to process CachedElectrumX.getAnonymitySet(): ",
error: e,
stackTrace: s,
);
rethrow;
}
Expand Down Expand Up @@ -155,16 +155,17 @@ class CachedElectrumXClient {
await box.put(txHash, result);
}

// Logging.instance.log("using fetched result", level: LogLevel.Info);
// Logging.instance.log("using fetched result");
return result;
} else {
// Logging.instance.log("using cached result", level: LogLevel.Info);
// Logging.instance.log("using cached result");
return Map<String, dynamic>.from(cachedTx);
}
} catch (e, s) {
Logging.instance.logd(
"Failed to process CachedElectrumX.getTransaction(): $e\n$s",
level: LogLevel.Error,
Logging.instance.e(
"Failed to process CachedElectrumX.getTransaction(): ",
error: e,
stackTrace: s,
);
rethrow;
}
Expand Down Expand Up @@ -212,9 +213,10 @@ class CachedElectrumXClient {

return resultingList;
} catch (e, s) {
Logging.instance.logd(
"Failed to process CachedElectrumX.getUsedCoinSerials(): $e\n$s",
level: LogLevel.Error,
Logging.instance.e(
"Failed to process CachedElectrumX.getUsedCoinSerials(): ",
error: e,
stackTrace: s,
);
rethrow;
}
Expand Down
7 changes: 4 additions & 3 deletions lib/electrumx_rpc/client_manager.dart
Original file line number Diff line number Diff line change
Expand Up @@ -69,9 +69,10 @@ class ClientManager {
_heightCompleters[key]!.complete(event.height);
}
},
onError: (Object err, StackTrace s) => Logging.instance.logd(
"ClientManager listen: $err\n$s",
level: LogLevel.Error,
onError: (Object err, StackTrace s) => Logging.instance.e(
"ClientManager listen",
error: err,
stackTrace: s,
),
);
}
Expand Down
Loading
Loading