Refactor logs

This commit is contained in:
problematicconsumer
2023-11-28 18:24:31 +03:30
parent bb745c2ec1
commit 9c165e178b
25 changed files with 272 additions and 163 deletions

View File

@@ -3,6 +3,7 @@ import 'package:flutter/foundation.dart';
import 'package:hiddify/core/prefs/prefs.dart';
import 'package:hiddify/data/data_providers.dart';
import 'package:hiddify/domain/singbox/singbox.dart';
import 'package:hiddify/features/log/model/log_level.dart';
import 'package:hiddify/utils/pref_notifier.dart';
import 'package:riverpod_annotation/riverpod_annotation.dart';

View File

@@ -240,24 +240,6 @@ class CoreFacadeImpl with ExceptionHandler, InfraLogger implements CoreFacade {
);
}
@override
Stream<Either<CoreServiceFailure, List<String>>> watchLogs() {
return singbox.watchLogs(filesEditor.coreLogsFile.path).handleExceptions(
(error, stackTrace) {
loggy.warning("error watching logs", error, stackTrace);
return CoreServiceFailure.unexpected(error, stackTrace);
},
);
}
@override
TaskEither<CoreServiceFailure, Unit> clearLogs() {
return exceptionHandler(
() => singbox.clearLogs().mapLeft(CoreServiceFailure.other).run(),
CoreServiceFailure.unexpected,
);
}
@override
Stream<ConnectionStatus> watchConnectionStatus() =>
singbox.watchConnectionStatus();