add proper logging

This commit is contained in:
shenlong-tanwen
2024-08-21 23:43:48 +05:30
parent 1631df70e9
commit 75448ce56b
37 changed files with 923 additions and 224 deletions
@@ -6,6 +6,15 @@ abstract class ILogRepository {
/// Fetches all logs
FutureOr<List<LogMessage>> fetchLogs();
/// Inserts a new log into the DB
FutureOr<bool> add(LogMessage log);
/// Bulk insert logs into DB
FutureOr<bool> addAll(List<LogMessage> log);
/// Clears all logs
FutureOr<bool> clear();
/// Truncates the logs to the most recent [limit]. Defaults to recent 250 logs
FutureOr<void> truncateLogs({int limit = 250});
}
@@ -9,19 +9,19 @@ abstract class IStoreConverter<T, U> {
U toPrimitive(T value);
/// Converts the value back to T? from the primitive type U from the Store
T? fromPrimitive(U value);
FutureOr<T?> fromPrimitive(U value);
}
abstract class IStoreRepository {
FutureOr<T?> getValue<T, U>(StoreKey<T, U> key);
FutureOr<T?> tryGet<T, U>(StoreKey<T, U> key);
FutureOr<bool> setValue<T, U>(StoreKey<T, U> key, T value);
FutureOr<T> get<T, U>(StoreKey<T, U> key);
FutureOr<void> deleteValue(StoreKey key);
FutureOr<bool> set<T, U>(StoreKey<T, U> key, T value);
Stream<T?> watchValue<T, U>(StoreKey<T, U> key);
FutureOr<void> delete(StoreKey key);
Stream<List<StoreValue>> watchStore();
Stream<T?> watch<T, U>(StoreKey<T, U> key);
FutureOr<void> clearStore();
}
@@ -0,0 +1,11 @@
import 'dart:async';
import 'package:immich_mobile/domain/models/user.model.dart';
abstract class IUserRepository {
/// Fetches user
FutureOr<User?> getUser(String userId);
/// Insert user
FutureOr<bool> insertUser(User user);
}