mirror of
https://github.com/Such-Software/hash-wallet.git
synced 2026-12-02 12:14:09 +01:00
sp debugging (#2426)
* feat(sp): debug logging feature * fix(sp): Receiver * feat(sp): handle and log failures and early returns --------- Co-authored-by: Omar Hatem <omarh.ismail1@gmail.com>
This commit is contained in:
@@ -1,7 +1,10 @@
|
||||
import 'dart:io';
|
||||
|
||||
import 'package:cake_wallet/bitcoin/bitcoin.dart';
|
||||
import 'package:cake_wallet/store/settings_store.dart';
|
||||
import 'package:cw_core/wallet_base.dart';
|
||||
import 'package:mobx/mobx.dart';
|
||||
import 'package:path_provider/path_provider.dart';
|
||||
|
||||
part 'silent_payments_settings_view_model.g.dart';
|
||||
|
||||
@@ -30,4 +33,16 @@ abstract class SilentPaymentsSettingsViewModelBase with Store {
|
||||
bitcoin!.setIsAlwaysScanningSP(_wallet, value);
|
||||
if (value) bitcoin!.setScanningActive(_wallet, true);
|
||||
}
|
||||
|
||||
Future<String> getAbbreviatedLogs() async {
|
||||
final appSupportPath = (await getApplicationSupportDirectory()).path;
|
||||
final logsFile = File("$appSupportPath/logs/debug.log");
|
||||
if (!logsFile.existsSync()) {
|
||||
return "";
|
||||
}
|
||||
final logs = logsFile.readAsStringSync();
|
||||
|
||||
// return last 10000 characters:
|
||||
return logs.substring(logs.length > 10000 ? logs.length - 10000 : 0);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user