Skip to content

armgit / ente

Public Imported from GitHub
0

πŸ’š End-to-end encrypted cloud for everything.

Revert "[mobile][photos] move debugPrint/print to logger calls"

Priyanshu Dangare3f72187a7086
diff --git a/mobile/apps/photos/integration_test/video_editor_test.dart b/mobile/apps/photos/integration_test/video_editor_test.dart
index d4be32c7a0..ff63ead9e9 100644
--- a/mobile/apps/photos/integration_test/video_editor_test.dart
+++ b/mobile/apps/photos/integration_test/video_editor_test.dart
@@ -174,7 +174,8 @@ void main() {
final logger = Logger("VideoEditorIntegrationTest");
Logger.root.level = Level.INFO;
Logger.root.onRecord.listen((record) {
- stdout.writeln('[${record.level.name}] ${record.time}: ${record.message}');
+ // ignore: avoid_print
+ print('[${record.level.name}] ${record.time}: ${record.message}');
});
// TEST CONFIGURATION - Update this list with your files and combinations
diff --git a/mobile/apps/photos/lib/db/common/base.dart b/mobile/apps/photos/lib/db/common/base.dart
index d27f8d45a1..3bbd0e2793 100644
--- a/mobile/apps/photos/lib/db/common/base.dart
+++ b/mobile/apps/photos/lib/db/common/base.dart
@@ -1,8 +1,7 @@
-import "package:logging/logging.dart";
+import "package:flutter/foundation.dart";
import "package:sqlite_async/sqlite_async.dart";
mixin SqlDbBase {
- static final Logger _logger = Logger("SqlDbBase");
static final Map<int, String> _params = <int, String>{};
static String getParams(int count) {
@@ -21,7 +20,7 @@ mixin SqlDbBase {
final toVersion = migrationScripts.length;
if (currentVersion < toVersion) {
- _logger.info(
+ debugPrint(
"$runtimeType migrating database from $currentVersion to $toVersion",
);
await database.writeTransaction((tx) async {
@@ -29,7 +28,7 @@ mixin SqlDbBase {
try {
await tx.execute(migrationScripts[i - 1]);
} catch (e) {
- _logger.warning(
+ debugPrint(
"$runtimeType Error running migration script index ${i - 1} $e",
);
rethrow;
diff --git a/mobile/apps/photos/lib/db/device_files_db.dart b/mobile/apps/photos/lib/db/device_files_db.dart
index 14f726603d..a8b07b9cc4 100644
--- a/mobile/apps/photos/lib/db/device_files_db.dart
+++ b/mobile/apps/photos/lib/db/device_files_db.dart
@@ -1,4 +1,5 @@
import 'package:collection/collection.dart';
+import 'package:flutter/foundation.dart';
import 'package:logging/logging.dart';
import 'package:photo_manager/photo_manager.dart';
import 'package:photos/db/files_db.dart';
@@ -20,7 +21,7 @@ extension DeviceFiles on FilesDB {
Map<String, Set<String>> mappingToAdd, {
ConflictAlgorithm conflictAlgorithm = ConflictAlgorithm.ignore,
}) async {
- _logger.info("Inserting missing PathIDToLocalIDMapping");
+ debugPrint("Inserting missing PathIDToLocalIDMapping");
final parameterSets = <List<Object?>>[];
int batchCounter = 0;
for (MapEntry e in mappingToAdd.entries) {
@@ -44,7 +45,7 @@ extension DeviceFiles on FilesDB {
Future<void> deletePathIDToLocalIDMapping(
Map<String, Set<String>> mappingsToRemove,
) async {
- _logger.info("removing PathIDToLocalIDMapping");
+ debugPrint("removing PathIDToLocalIDMapping");
final parameterSets = <List<Object?>>[];
int batchCounter = 0;
for (MapEntry e in mappingsToRemove.entries) {
@@ -403,7 +404,7 @@ extension DeviceFiles on FilesDB {
Future<List<DeviceCollection>> getDeviceCollections({
bool includeCoverThumbnail = false,
}) async {
- _logger.info(
+ debugPrint(
"Fetching DeviceCollections From DB with thumbnail = "
"$includeCoverThumbnail",
);
@@ -465,7 +466,7 @@ extension DeviceFiles on FilesDB {
}
Future<EnteFile?> getDeviceCollectionThumbnail(String pathID) async {
- _logger.info("Call fallback method to get potential thumbnail");
+ debugPrint("Call fallback method to get potential thumbnail");
final db = await sqliteAsyncDB;
final fileRows = await db.getAll(
'''SELECT * FROM FILES f JOIN device_files df on f.local_id = df.id
diff --git a/mobile/apps/photos/lib/db/entities_db.dart b/mobile/apps/photos/lib/db/entities_db.dart
index 8460342f8f..0d097c9b03 100644
--- a/mobile/apps/photos/lib/db/entities_db.dart
+++ b/mobile/apps/photos/lib/db/entities_db.dart
@@ -1,17 +1,15 @@
-import 'package:logging/logging.dart';
+import 'package:flutter/foundation.dart';
import 'package:photos/db/files_db.dart';
import "package:photos/gateways/entity/models/type.dart";
import "package:photos/models/local_entity_data.dart";
import 'package:sqflite/sqlite_api.dart';
extension EntitiesDB on FilesDB {
- static final Logger _logger = Logger("EntitiesDB");
-
Future<void> upsertEntities(
List<LocalEntityData> data, {
ConflictAlgorithm conflictAlgorithm = ConflictAlgorithm.replace,
}) async {
- _logger.info("entitiesDB: upsertEntities ${data.length} entities");
+ debugPrint("entitiesDB: upsertEntities ${data.length} entities");
final db = await sqliteAsyncDB;
final parameterSets = <List<Object?>>[];
int batchCounter = 0;
diff --git a/mobile/apps/photos/lib/db/file_updation_db.dart b/mobile/apps/photos/lib/db/file_updation_db.dart
index 7954ed97a2..82942a3728 100644
--- a/mobile/apps/photos/lib/db/file_updation_db.dart
+++ b/mobile/apps/photos/lib/db/file_updation_db.dart
@@ -1,5 +1,6 @@
import 'dart:io';
+import 'package:flutter/foundation.dart';
import 'package:logging/logging.dart';
import 'package:path/path.dart';
import 'package:path_provider/path_provider.dart';
@@ -65,7 +66,7 @@ class FileUpdationDB {
final Directory documentsDirectory =
await getApplicationDocumentsDirectory();
final String path = join(documentsDirectory.path, _databaseName);
- _logger.info("DB path $path");
+ debugPrint("DB path " + path);
return await openDatabaseWithMigration(path, dbConfig);
}
diff --git a/mobile/apps/photos/lib/db/files_db.dart b/mobile/apps/photos/lib/db/files_db.dart
index 79f6cb78d5..467c07c640 100644
--- a/mobile/apps/photos/lib/db/files_db.dart
+++ b/mobile/apps/photos/lib/db/files_db.dart
@@ -426,7 +426,7 @@ class FilesDB with SqlDbBase {
Future<void> deleteDB() async {
if (kDebugMode) {
- _logger.info("Deleting files db");
+ debugPrint("Deleting files db");
final Directory documentsDirectory =
await getApplicationDocumentsDirectory();
final String path = join(documentsDirectory.path, _databaseName);
diff --git a/mobile/apps/photos/lib/db/social_db.dart b/mobile/apps/photos/lib/db/social_db.dart
index 8128bf2869..28ff6085e8 100644
--- a/mobile/apps/photos/lib/db/social_db.dart
+++ b/mobile/apps/photos/lib/db/social_db.dart
@@ -1,6 +1,7 @@
import 'dart:async';
import 'dart:io';
+import 'package:flutter/foundation.dart';
import 'package:logging/logging.dart';
import 'package:path/path.dart';
import 'package:path_provider/path_provider.dart';
@@ -122,7 +123,7 @@ class SocialDB {
);
if (rows.isEmpty) {
- _logger.info('deleteComment: Comment $id does not exist');
+ debugPrint('deleteComment: Comment $id does not exist');
return null;
}
diff --git a/mobile/apps/photos/lib/models/collection/collection.dart b/mobile/apps/photos/lib/models/collection/collection.dart
index 4230941ffe..6c369cc02a 100644
--- a/mobile/apps/photos/lib/models/collection/collection.dart
+++ b/mobile/apps/photos/lib/models/collection/collection.dart
@@ -1,6 +1,6 @@
import 'dart:core';
-import "package:logging/logging.dart";
+import 'package:flutter/foundation.dart';
import "package:photos/core/configuration.dart";
import "package:photos/extensions/user_extension.dart";
import "package:photos/gateways/collections/models/public_url.dart";
@@ -8,8 +8,6 @@ import "package:photos/models/api/collection/user.dart";
import "package:photos/models/metadata/collection_magic.dart";
import "package:photos/models/metadata/common_keys.dart";
-final _logger = Logger("Collection");
-
class Collection {
final int id;
final User owner;
@@ -349,7 +347,7 @@ CollectionType typeFromString(String type) {
case "unknown":
return CollectionType.unknown;
}
- _logger.warning("unexpected collection type $type");
+ debugPrint("unexpected collection type $type");
return CollectionType.unknown;
}
diff --git a/mobile/apps/photos/lib/models/gallery_type.dart b/mobile/apps/photos/lib/models/gallery_type.dart
index 04e8647fd2..712a05cf0b 100644
--- a/mobile/apps/photos/lib/models/gallery_type.dart
+++ b/mobile/apps/photos/lib/models/gallery_type.dart
@@ -1,8 +1,6 @@
-import "package:logging/logging.dart";
+import "package:flutter/foundation.dart";
import 'package:photos/models/collection/collection.dart';
-final _logger = Logger("GalleryType");
-
enum GalleryType {
homepage,
archive,
@@ -470,7 +468,7 @@ GalleryType getGalleryType(Collection c, int userID) {
} else if (c.isHidden()) {
return GalleryType.hiddenOwnedCollection;
}
- _logger.info(
+ debugPrint(
"Unknown gallery type for collection ${c.id}, falling back to "
"default",
);
diff --git a/mobile/apps/photos/lib/models/metadata/file_magic.dart b/mobile/apps/photos/lib/models/metadata/file_magic.dart
index f9344b3447..04658dc52b 100644
--- a/mobile/apps/photos/lib/models/metadata/file_magic.dart
+++ b/mobile/apps/photos/lib/models/metadata/file_magic.dart
@@ -1,6 +1,6 @@
import "dart:convert";
-import "package:logging/logging.dart";
+import "package:flutter/cupertino.dart";
import 'package:photos/models/metadata/common_keys.dart';
const editTimeKey = 'editedTime';
@@ -46,8 +46,6 @@ class MagicMetadata {
}
class PubMagicMetadata {
- static final Logger _logger = Logger("PubMagicMetadata");
-
int? editedTime;
String? editedName;
String? caption;
@@ -142,7 +140,7 @@ class PubMagicMetadata {
if (value == null) return null;
if (value is int) return value;
if (value is String) return int.tryParse(value);
- _logger.warning("PubMagicMetadata key: $key Unexpected value: $value");
+ debugPrint("PubMagicMetadata key: $key Unexpected value: $value");
return null;
}
@@ -150,7 +148,7 @@ class PubMagicMetadata {
if (value == null) return null;
if (value is num) return value.toDouble();
if (value is String) return double.tryParse(value);
- _logger.warning("PubMagicMetadata key: $key Unexpected value: $value");
+ debugPrint("PubMagicMetadata key: $key Unexpected value: $value");
return null;
}
}
diff --git a/mobile/apps/photos/lib/models/ml/face/person.dart b/mobile/apps/photos/lib/models/ml/face/person.dart
index 4cb687b6d9..e3c2e87dc0 100644
--- a/mobile/apps/photos/lib/models/ml/face/person.dart
+++ b/mobile/apps/photos/lib/models/ml/face/person.dart
@@ -2,7 +2,6 @@
// On the remote server, the PersonEntity is stored as {Entity} with type person.
// On the device, this information is stored as [LocalEntityData] with type person.
import "package:flutter/foundation.dart";
-import "package:logging/logging.dart";
const Object _personDataUnchanged = Object();
@@ -35,8 +34,6 @@ class ClusterInfo {
}
class PersonData {
- static final Logger _logger = Logger("PersonData");
-
final String name;
/// Used to mark a person to not show in the people section.
@@ -127,7 +124,7 @@ class PersonData {
for (var cluster in assigned) {
sb.writeln('Cluster: ${cluster.id} - ${cluster.faces.length}');
}
- _logger.info(sb.toString());
+ debugPrint(sb.toString());
}
// toJson
diff --git a/mobile/apps/photos/lib/services/collections_service.dart b/mobile/apps/photos/lib/services/collections_service.dart
index 741b61dc1b..d736e29078 100644
--- a/mobile/apps/photos/lib/services/collections_service.dart
+++ b/mobile/apps/photos/lib/services/collections_service.dart
@@ -394,7 +394,7 @@ class CollectionsService {
return Future.value(_coverCache[coverKey]!);
}
if (kDebugMode) {
- _logger.info("getCover for collection ${c.id} ${c.displayName}");
+ debugPrint("getCover for collection ${c.id} ${c.displayName}");
}
if (c.hasCover) {
final coverID = c.pubMagicMetadata.coverID ?? 0;
@@ -963,7 +963,7 @@ class CollectionsService {
}
} on DioException catch (e) {
if (e.response != null) {
- _logger.warning("Error ${e.response}");
+ debugPrint("Error " + e.response!.toString());
}
rethrow;
} catch (e) {
@@ -1119,7 +1119,7 @@ class CollectionsService {
if (_cachedKeys.containsKey(collection.id)) {
return _cachedKeys[collection.id]!;
}
- _logger.info(
+ debugPrint(
"Compute collection decryption key for ${collection.id} source"
" $source",
);
@@ -2530,12 +2530,10 @@ class CollectionsService {
String _decryptCollectionPath(Collection collection) {
if (collection.decryptedPath != null &&
collection.decryptedPath!.isNotEmpty) {
- _logger.info(
- "Using cached decrypted path for collection ${collection.id}",
- );
+ debugPrint("Using cached decrypted path for collection ${collection.id}");
return collection.decryptedPath!;
} else {
- _logger.info(
+ debugPrint(
"Decrypting path for collection ${collection.id} from "
"encryptedPath",
);
diff --git a/mobile/apps/photos/lib/services/entity_service.dart b/mobile/apps/photos/lib/services/entity_service.dart
index 6470bfd053..41e801680d 100644
--- a/mobile/apps/photos/lib/services/entity_service.dart
+++ b/mobile/apps/photos/lib/services/entity_service.dart
@@ -26,7 +26,7 @@ class EntityService {
late final FilesDB _db = FilesDB.instance;
EntityService(this._prefs, this._gateway) {
- _logger.info("EntityService constructor");
+ debugPrint("EntityService constructor");
}
String _getEntityKeyPrefix(EntityType type) {
@@ -80,7 +80,7 @@ class EntityService {
encryptedData = CryptoUtil.bin2base64(encryptedKeyData.encryptedData!);
header = CryptoUtil.bin2base64(encryptedKeyData.header!);
}
- _logger.info(
+ debugPrint(
" ${id == null ? 'Adding' : 'Updating'} entity of type: " + type.name,
);
diff --git a/mobile/apps/photos/lib/services/favorites_service.dart b/mobile/apps/photos/lib/services/favorites_service.dart
index 69086ec7e3..3eecb4c7af 100644
--- a/mobile/apps/photos/lib/services/favorites_service.dart
+++ b/mobile/apps/photos/lib/services/favorites_service.dart
@@ -3,7 +3,6 @@ import 'dart:convert';
import 'package:ente_crypto/ente_crypto.dart';
import 'package:flutter/material.dart';
-import 'package:logging/logging.dart';
import 'package:photos/core/configuration.dart';
import 'package:photos/core/event_bus.dart';
import 'package:photos/db/files_db.dart';
@@ -19,8 +18,6 @@ import 'package:photos/services/sync/remote_sync_service.dart';
import 'package:photos/ui/actions/collection/collection_sharing_actions.dart';
class FavoritesService {
- final _logger = Logger("FavoritesService");
-
late Configuration _config;
late CollectionsService _collectionsService;
@@ -91,9 +88,7 @@ class FavoritesService {
if (file.collectionID != null &&
_cachedFavoritesCollectionID != null &&
file.collectionID == _cachedFavoritesCollectionID) {
- _logger.info(
- "File ${file.uploadedFileID} is part of favorite collection",
- );
+ debugPrint("File ${file.uploadedFileID} is part of favorite collection");
return true;
}
if (checkOnlyAlbum) {
diff --git a/mobile/apps/photos/lib/services/location_service.dart b/mobile/apps/photos/lib/services/location_service.dart
index 4fa64104e5..24bf05a540 100644
--- a/mobile/apps/photos/lib/services/location_service.dart
+++ b/mobile/apps/photos/lib/services/location_service.dart
@@ -43,7 +43,7 @@ class LocationService {
List<BaseLocation> baseLocations = [];
LocationService(this.prefs) {
- _logger.info('LocationService constructor');
+ debugPrint('LocationService constructor');
Future.delayed(const Duration(seconds: 3), () {
_loadCities();
});
diff --git a/mobile/apps/photos/lib/services/machine_learning/face_ml/feedback/cluster_feedback.dart b/mobile/apps/photos/lib/services/machine_learning/face_ml/feedback/cluster_feedback.dart
index 099b5ae347..13d28a1258 100644
--- a/mobile/apps/photos/lib/services/machine_learning/face_ml/feedback/cluster_feedback.dart
+++ b/mobile/apps/photos/lib/services/machine_learning/face_ml/feedback/cluster_feedback.dart
@@ -2100,7 +2100,7 @@ class ClusterFeedbackService<T> {
bool onlySortBigSuggestions = true,
}) async {
if (suggestions.isEmpty) {
- _logger.info('No suggestions to sort');
+ debugPrint('No suggestions to sort');
return;
}
if (onlySortBigSuggestions) {
@@ -2110,7 +2110,7 @@ class ClusterFeedbackService<T> {
)
.toList();
if (bigSuggestions.isEmpty) {
- _logger.info('No big suggestions to sort');
+ debugPrint('No big suggestions to sort');
return;
}
}
@@ -2173,7 +2173,7 @@ class ClusterFeedbackService<T> {
});
w?.log('sorted files for cluster $clusterID');
- _logger.info(
+ debugPrint(
"[${_logger.name}] Sorted suggestions for cluster $clusterID based on distance to person: ${suggestion.filesInCluster.map((e) => fileIdToDistanceMap[e.uploadedFileID]).toList()}",
);
}
diff --git a/mobile/apps/photos/lib/services/machine_learning/ml_indexing_isolate.dart b/mobile/apps/photos/lib/services/machine_learning/ml_indexing_isolate.dart
index d4d2959c92..13071cf6e6 100644
--- a/mobile/apps/photos/lib/services/machine_learning/ml_indexing_isolate.dart
+++ b/mobile/apps/photos/lib/services/machine_learning/ml_indexing_isolate.dart
@@ -1,7 +1,7 @@
import "dart:async";
import "dart:io" show Platform;
-import "package:flutter/foundation.dart" show kDebugMode;
+import "package:flutter/foundation.dart" show debugPrint, kDebugMode;
import "package:logging/logging.dart";
import "package:photos/service_locator.dart"
show flagService, isLocalGalleryMode, localSettings;
@@ -121,7 +121,7 @@ class MLIndexingIsolate extends SuperIsolate {
s,
);
if (kDebugMode) {
- _logger.info(
+ debugPrint(
"This image with fileID ${instruction.fileKey} has name ${instruction.file.displayName}.",
);
}
diff --git a/mobile/apps/photos/lib/services/remote_assets_service.dart b/mobile/apps/photos/lib/services/remote_assets_service.dart
index fa8791bf83..e4feb37793 100644
--- a/mobile/apps/photos/lib/services/remote_assets_service.dart
+++ b/mobile/apps/photos/lib/services/remote_assets_service.dart
@@ -630,7 +630,7 @@ class RemoteAssetsService {
final boundedReceived = received > total ? total : received;
_progressController.add((url, boundedReceived, total));
} else if (kDebugMode) {
- _logger.info("$url Received: $received, Total: $total");
+ debugPrint("$url Received: $received, Total: $total");
}
}
diff --git a/mobile/apps/photos/lib/services/search_service.dart b/mobile/apps/photos/lib/services/search_service.dart
index eb14d06dd3..30feeece55 100644
--- a/mobile/apps/photos/lib/services/search_service.dart
+++ b/mobile/apps/photos/lib/services/search_service.dart
@@ -1084,7 +1084,7 @@ class SearchService {
if (showIgnoredOnly) {
return [];
}
- _logger.info("getting faces (localGallery)");
+ debugPrint("getting faces (localGallery)");
final localGalleryMlDb = MLDataDB.localGalleryInstance;
final Map<int, Set<String>> fileIdToClusterID = await localGalleryMlDb
.getFileIdToClusterIds();
@@ -1166,7 +1166,7 @@ class SearchService {
}
return facesResult;
}
- _logger.info("getting faces");
+ debugPrint("getting faces");
final Map<int, Set<String>> fileIdToClusterID = await mlDataDB
.getFileIdToClusterIds();
final Map<String, PersonEntity> personIdToPerson = await PersonService
diff --git a/mobile/apps/photos/lib/services/storage_bonus_service.dart b/mobile/apps/photos/lib/services/storage_bonus_service.dart
index 54b3f28af5..fb32eee9d6 100644
--- a/mobile/apps/photos/lib/services/storage_bonus_service.dart
+++ b/mobile/apps/photos/lib/services/storage_bonus_service.dart
@@ -1,12 +1,10 @@
import "package:dio/dio.dart";
-import "package:logging/logging.dart";
+import "package:flutter/foundation.dart";
import "package:photos/gateways/storage_bonus/models/storage_bonus.dart";
import "package:photos/gateways/storage_bonus/storage_bonus_gateway.dart";
import "package:shared_preferences/shared_preferences.dart";
class StorageBonusService {
- final _logger = Logger("StorageBonusService");
-
final StorageBonusGateway gateway;
final SharedPreferences prefs;
@@ -15,7 +13,7 @@ class StorageBonusService {
StorageBonusService(this.prefs, Dio enteDio)
: gateway = StorageBonusGateway(enteDio) {
- _logger.info("StorageBonusService constructor");
+ debugPrint("StorageBonusService constructor");
}
// returns true if _showStorageBonusTapCount value is less than minTapCountBeforeHidingBanner
diff --git a/mobile/apps/photos/lib/services/sync/local_sync_service.dart b/mobile/apps/photos/lib/services/sync/local_sync_service.dart
index b0d032a38b..b54e31a39e 100644
--- a/mobile/apps/photos/lib/services/sync/local_sync_service.dart
+++ b/mobile/apps/photos/lib/services/sync/local_sync_service.dart
@@ -243,7 +243,7 @@ class LocalSyncService {
"un-synced files",
);
}
- _logger.info(
+ debugPrint(
"syncAll: mappingChange : $hasAnyMappingChanged, "
"unSyncedFiles: $hasUnsyncedFiles",
);
diff --git a/mobile/apps/photos/lib/services/sync/remote_sync_service.dart b/mobile/apps/photos/lib/services/sync/remote_sync_service.dart
index cc0e50aeb2..856206a5c5 100644
--- a/mobile/apps/photos/lib/services/sync/remote_sync_service.dart
+++ b/mobile/apps/photos/lib/services/sync/remote_sync_service.dart
@@ -466,7 +466,7 @@ class RemoteSyncService {
existingMapping,
);
if (commonElements.isNotEmpty) {
- _logger.info(
+ debugPrint(
"${commonElements.length} files already existing in "
"collection $collectionID for ${deviceCollection.name}",
);
@@ -477,7 +477,7 @@ class RemoteSyncService {
// new file entries, where we can store mapping for localID and
// corresponding collection ID
if (localIDsToSync.isNotEmpty) {
- _logger.info(
+ debugPrint(
'Adding new entries for ${localIDsToSync.length} files'
' for ${deviceCollection.name}',
);
diff --git a/mobile/apps/photos/lib/services/update_service.dart b/mobile/apps/photos/lib/services/update_service.dart
index 6284969079..3eb8a88ef0 100644
--- a/mobile/apps/photos/lib/services/update_service.dart
+++ b/mobile/apps/photos/lib/services/update_service.dart
@@ -28,7 +28,7 @@ class UpdateService {
UpdateService(SharedPreferences prefs, PackageInfo packageInfo)
: _prefs = prefs,
_packageInfo = packageInfo {
- _logger.info("UpdateService constructor");
+ debugPrint("UpdateService constructor");
}
Future<bool> shouldShowChangeLog() async {
diff --git a/mobile/apps/photos/lib/ui/account/passkey_page.dart b/mobile/apps/photos/lib/ui/account/passkey_page.dart
index c4b5712def..257cca0299 100644
--- a/mobile/apps/photos/lib/ui/account/passkey_page.dart
+++ b/mobile/apps/photos/lib/ui/account/passkey_page.dart
@@ -196,8 +196,8 @@ class _PasskeyPageState extends State<PasskeyPage> {
onTap: () async {
try {
await checkStatus();
- } catch (e, s) {
- _logger.warning('failed to check status', e, s);
+ } catch (e) {
+ debugPrint('failed to check status $e');
showGenericErrorBottomSheet(
context: context,
error: e,
diff --git a/mobile/apps/photos/lib/ui/collections/album/horizontal_list.dart b/mobile/apps/photos/lib/ui/collections/album/horizontal_list.dart
index ed8d54e11b..c0e544902e 100644
--- a/mobile/apps/photos/lib/ui/collections/album/horizontal_list.dart
+++ b/mobile/apps/photos/lib/ui/collections/album/horizontal_list.dart
@@ -65,7 +65,7 @@ class _AlbumHorizontalListState extends State<AlbumHorizontalList> {
final sideOfThumbnail =
(screenWidth - totalHorizontalPadding - horizontalPadding) /
albumsCountInRow;
- _logger.info('$runtimeType widget build');
+ debugPrint('$runtimeType widget build');
return FutureBuilder<List<Collection>>(
future: widget.collectionsFuture(),
builder: (context, snapshot) {
diff --git a/mobile/apps/photos/lib/ui/common/progress_dialog.dart b/mobile/apps/photos/lib/ui/common/progress_dialog.dart
index 56e48f5719..e04e5efc5f 100644
--- a/mobile/apps/photos/lib/ui/common/progress_dialog.dart
+++ b/mobile/apps/photos/lib/ui/common/progress_dialog.dart
@@ -1,12 +1,9 @@
import "dart:async";
import 'package:flutter/material.dart';
-import "package:logging/logging.dart";
enum ProgressDialogType { normal, download }
-final _logger = Logger("ProgressDialog");
-
String _dialogMessage = "Loading...";
double _progress = 0.0, _maxProgress = 100.0;
@@ -139,14 +136,15 @@ class ProgressDialog {
Navigator.of(_dismissingContext!).pop();
}
_dialog = null;
- if (_showLogs) _logger.info('ProgressDialog dismissed');
+ if (_showLogs) debugPrint('ProgressDialog dismissed');
return Future.value(true);
} else {
- if (_showLogs) _logger.info('ProgressDialog already dismissed');
+ if (_showLogs) debugPrint('ProgressDialog already dismissed');
return Future.value(false);
}
- } catch (err, stackTrace) {
- _logger.warning('Seems there is an issue hiding dialog', err, stackTrace);
+ } catch (err) {
+ debugPrint('Seems there is an issue hiding dialog');
+ debugPrint(err.toString());
return Future.value(false);
}
}
@@ -185,16 +183,17 @@ class ProgressDialog {
// Delaying the function for 200 milliseconds
// [Default transitionDuration of DialogRoute]
await Future.delayed(const Duration(milliseconds: 200));
- if (_showLogs) _logger.info('ProgressDialog shown');
+ if (_showLogs) debugPrint('ProgressDialog shown');
return true;
} else {
- if (_showLogs) _logger.info("ProgressDialog already shown/showing");
+ if (_showLogs) debugPrint("ProgressDialog already shown/showing");
return false;
}
- } catch (err, stackTrace) {
+ } catch (err) {
_isShowing = false;
_dialog = null;
- _logger.warning('Exception while showing the dialog', err, stackTrace);
+ debugPrint('Exception while showing the dialog');
+ debugPrint(err.toString());
return false;
}
}
@@ -223,7 +222,7 @@ class _BodyState extends State<_Body> {
@override
void dispose() {
_isShowing = false;
- if (_showLogs) _logger.info('ProgressDialog dismissed by back button');
+ if (_showLogs) debugPrint('ProgressDialog dismissed by back button');
super.dispose();
}
diff --git a/mobile/apps/photos/lib/ui/home/home_bottom_nav_bar.dart b/mobile/apps/photos/lib/ui/home/home_bottom_nav_bar.dart
index 9efea16202..69e4c6e52f 100644
--- a/mobile/apps/photos/lib/ui/home/home_bottom_nav_bar.dart
+++ b/mobile/apps/photos/lib/ui/home/home_bottom_nav_bar.dart
@@ -6,7 +6,6 @@ import 'package:ente_components/theme/spacing.dart';
import 'package:ente_components/theme/theme.dart';
import 'package:flutter/material.dart';
import 'package:flutter_svg/flutter_svg.dart';
-import "package:logging/logging.dart";
import 'package:photos/core/event_bus.dart';
import 'package:photos/events/tab_changed_event.dart';
import "package:photos/models/selected_albums.dart";
@@ -35,8 +34,6 @@ class HomeBottomNavigationBar extends StatefulWidget {
}
class _HomeBottomNavigationBarState extends State<HomeBottomNavigationBar> {
- final _logger = Logger("_HomeBottomNavigationBarState");
-
static const int _searchTabIndex = 3;
static const Duration _doubleTapWindow = Duration(milliseconds: 350);
late StreamSubscription<TabChangedEvent> _tabChangedEventSubscription;
@@ -54,7 +51,7 @@ class _HomeBottomNavigationBarState extends State<HomeBottomNavigationBar> {
event,
) {
if (event.source != TabChangedEventSource.tabBar) {
- _logger.info(
+ debugPrint(
'${(TabChangedEvent).toString()} index changed from '
'$currentTabIndex to ${event.selectedIndex} via ${event.source}',
);
@@ -95,7 +92,7 @@ class _HomeBottomNavigationBarState extends State<HomeBottomNavigationBar> {
if (mode == "OnPressed") {
_handleSearchTabDoubleTap(index);
}
- _logger.info("_TabChanged called via method $mode");
+ debugPrint("_TabChanged called via method $mode");
Bus.instance.fire(TabChangedEvent(index, TabChangedEventSource.tabBar));
}
diff --git a/mobile/apps/photos/lib/ui/map/map_screen.dart b/mobile/apps/photos/lib/ui/map/map_screen.dart
index 612e32f59b..af4311d18d 100644
--- a/mobile/apps/photos/lib/ui/map/map_screen.dart
+++ b/mobile/apps/photos/lib/ui/map/map_screen.dart
@@ -116,7 +116,7 @@ class _MapScreenState extends State<MapScreen> {
);
if (kDebugMode) {
- _logger.info(
+ debugPrint(
"Info for map: center $center, initialZoom ${widget.initialZoom}",
);
}
diff --git a/mobile/apps/photos/lib/ui/settings/pending_sync/path_info_storage_viewer.dart b/mobile/apps/photos/lib/ui/settings/pending_sync/path_info_storage_viewer.dart
index 6ad8689821..eb8f3d4abf 100644
--- a/mobile/apps/photos/lib/ui/settings/pending_sync/path_info_storage_viewer.dart
+++ b/mobile/apps/photos/lib/ui/settings/pending_sync/path_info_storage_viewer.dart
@@ -114,7 +114,7 @@ class _PathInfoStorageViewerState extends State<PathInfoStorageViewer> {
onTap: () async {
if (kDebugMode) {
await Clipboard.setData(ClipboardData(text: widget.item.path));
- _logger.info(widget.item.path);
+ debugPrint(widget.item.path);
}
},
onDoubleTap: () async {
diff --git a/mobile/apps/photos/lib/ui/tabs/home_widget.dart b/mobile/apps/photos/lib/ui/tabs/home_widget.dart
index b03958afc6..d39405f4ef 100644
--- a/mobile/apps/photos/lib/ui/tabs/home_widget.dart
+++ b/mobile/apps/photos/lib/ui/tabs/home_widget.dart
@@ -185,7 +185,7 @@ class _HomeWidgetState extends State<HomeWidget> {
isOnSearchTabNotifier.value = false;
}
if (event.source != TabChangedEventSource.pageView) {
- _logger.info(
+ debugPrint(
"TabChange going from $previousTabIndex to ${event.selectedIndex} source: ${event.source}",
);
if (_pageController.hasClients) {
@@ -1274,7 +1274,7 @@ class _HomeWidgetState extends State<HomeWidget> {
if (!mounted) return;
final String? payload = notificationResponse.payload;
if (payload != null) {
- _logger.info('notification payload: $payload');
+ debugPrint('notification payload: $payload');
final uri = Uri.tryParse(payload);
if (uri != null &&
(uri.host.toLowerCase() == "ritual" ||
diff --git a/mobile/apps/photos/lib/ui/tabs/nav_bar.dart b/mobile/apps/photos/lib/ui/tabs/nav_bar.dart
index 0b45a3dfc7..cebbe05635 100644
--- a/mobile/apps/photos/lib/ui/tabs/nav_bar.dart
+++ b/mobile/apps/photos/lib/ui/tabs/nav_bar.dart
@@ -1,6 +1,5 @@
import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
-import "package:logging/logging.dart";
import "package:photos/theme/effects.dart";
class GNav extends StatefulWidget {
@@ -66,8 +65,6 @@ class GNav extends StatefulWidget {
}
class _GNavState extends State<GNav> {
- final _logger = Logger("_GNavState");
-
int? selectedIndex;
bool clickable = true;
@@ -78,7 +75,7 @@ class _GNavState extends State<GNav> {
@override
Widget build(BuildContext context) {
- _logger.info(
+ debugPrint(
'${(_GNavState).toString()} - build with index ${widget.selectedIndex}',
);
selectedIndex = widget.selectedIndex;
diff --git a/mobile/apps/photos/lib/ui/tools/debug/app_storage_viewer.dart b/mobile/apps/photos/lib/ui/tools/debug/app_storage_viewer.dart
index b4aa410276..2cc9d51ec2 100644
--- a/mobile/apps/photos/lib/ui/tools/debug/app_storage_viewer.dart
+++ b/mobile/apps/photos/lib/ui/tools/debug/app_storage_viewer.dart
@@ -131,7 +131,7 @@ class _AppStorageViewerState extends State<AppStorageViewer> {
@override
Widget build(BuildContext context) {
- _logger.info("$runtimeType building");
+ debugPrint("$runtimeType building");
return Scaffold(
body: CustomScrollView(
diff --git a/mobile/apps/photos/lib/ui/tools/debug/path_storage_viewer.dart b/mobile/apps/photos/lib/ui/tools/debug/path_storage_viewer.dart
index 4b710edc4d..6225779631 100644
--- a/mobile/apps/photos/lib/ui/tools/debug/path_storage_viewer.dart
+++ b/mobile/apps/photos/lib/ui/tools/debug/path_storage_viewer.dart
@@ -121,7 +121,7 @@ class _PathStorageViewerState extends State<PathStorageViewer> {
onTap: () async {
if (kDebugMode) {
await Clipboard.setData(ClipboardData(text: widget.item.path));
- _logger.info(widget.item.path);
+ debugPrint(widget.item.path);
}
},
onDoubleTap: () async {
diff --git a/mobile/apps/photos/lib/ui/tools/editor/image_editor/image_editor_page.dart b/mobile/apps/photos/lib/ui/tools/editor/image_editor/image_editor_page.dart
index 6c5080ad41..a179e5d47f 100644
--- a/mobile/apps/photos/lib/ui/tools/editor/image_editor/image_editor_page.dart
+++ b/mobile/apps/photos/lib/ui/tools/editor/image_editor/image_editor_page.dart
@@ -68,7 +68,7 @@ class _ImageEditorPageState extends State<ImageEditorPage> {
);
await dialog.show();
- _logger.info("Image saved with size: ${bytes.length} bytes");
+ debugPrint("Image saved with size: ${bytes.length} bytes");
final DateTime start = DateTime.now();
bool hasStoppedChangeNotify = false;
diff --git a/mobile/apps/photos/lib/ui/viewer/actions/album_selection_action_widget.dart b/mobile/apps/photos/lib/ui/viewer/actions/album_selection_action_widget.dart
index 92e47b7663..98d3fef121 100644
--- a/mobile/apps/photos/lib/ui/viewer/actions/album_selection_action_widget.dart
+++ b/mobile/apps/photos/lib/ui/viewer/actions/album_selection_action_widget.dart
@@ -284,7 +284,7 @@ class _AlbumSelectionActionWidgetState
nonEmptyCollection,
);
if (result == false) {
- _logger.warning("Failed to delete collection");
+ debugPrint("Failed to delete collection");
}
}
if (hasFavorites) {
diff --git a/mobile/apps/photos/lib/ui/viewer/actions/delete_empty_albums.dart b/mobile/apps/photos/lib/ui/viewer/actions/delete_empty_albums.dart
index 6e27f4a093..06ef66098a 100644
--- a/mobile/apps/photos/lib/ui/viewer/actions/delete_empty_albums.dart
+++ b/mobile/apps/photos/lib/ui/viewer/actions/delete_empty_albums.dart
@@ -1,6 +1,5 @@
import "package:ente_components/ente_components.dart";
import 'package:flutter/material.dart';
-import "package:logging/logging.dart";
import 'package:photos/core/event_bus.dart';
import "package:photos/db/files_db.dart";
import 'package:photos/events/collection_updated_event.dart';
@@ -24,8 +23,6 @@ class DeleteEmptyAlbums extends StatefulWidget {
}
class _DeleteEmptyAlbumsState extends State<DeleteEmptyAlbums> {
- final _logger = Logger("_DeleteEmptyAlbumsState");
-
final ValueNotifier<String> _deleteProgress = ValueNotifier("");
bool _isCancelled = false;
@@ -136,7 +133,7 @@ class _DeleteEmptyAlbumsState extends State<DeleteEmptyAlbums> {
}
}
if (failedCount > 0) {
- _logger.warning("Delete ops failed for $failedCount collections");
+ debugPrint("Delete ops failed for $failedCount collections");
}
}
}
diff --git a/mobile/apps/photos/lib/ui/viewer/actions/file_selection_overlay_bar.dart b/mobile/apps/photos/lib/ui/viewer/actions/file_selection_overlay_bar.dart
index 118f33f88d..032ef09abc 100644
--- a/mobile/apps/photos/lib/ui/viewer/actions/file_selection_overlay_bar.dart
+++ b/mobile/apps/photos/lib/ui/viewer/actions/file_selection_overlay_bar.dart
@@ -3,7 +3,6 @@ import "dart:io";
import "package:ente_components/ente_components.dart" as components;
import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
-import "package:logging/logging.dart";
import "package:photos/generated/l10n.dart";
import 'package:photos/models/collection/collection.dart';
import 'package:photos/models/gallery_type.dart';
@@ -46,8 +45,6 @@ class FileSelectionOverlayBar extends StatefulWidget {
class _FileSelectionOverlayBarState extends State<FileSelectionOverlayBar>
with BoundaryReporter {
- final _logger = Logger("_FileSelectionOverlayBarState");
-
final ValueNotifier<bool> _hasSelectedFilesNotifier = ValueNotifier(false);
late GalleryType _galleryType;
SearchFilterDataProvider? _searchFilterDataProvider;
@@ -109,7 +106,7 @@ class _FileSelectionOverlayBarState extends State<FileSelectionOverlayBar>
@override
Widget build(BuildContext context) {
- _logger.info(
+ debugPrint(
'$runtimeType building with ${widget.selectedFiles.files.length}',
);
diff --git a/mobile/apps/photos/lib/ui/viewer/file/detail_page.dart b/mobile/apps/photos/lib/ui/viewer/file/detail_page.dart
index 6765a67af1..acc58f92c4 100644
--- a/mobile/apps/photos/lib/ui/viewer/file/detail_page.dart
+++ b/mobile/apps/photos/lib/ui/viewer/file/detail_page.dart
@@ -419,7 +419,7 @@ class _BodyState extends State<_Body> {
onPageChanged: (index) {
if (_selectedIndexNotifier.value == index) {
if (kDebugMode) {
- _logger.info("onPageChanged called with same index $index");
+ debugPrint("onPageChanged called with same index $index");
}
// always notify listeners when the index is the same because
// the total number of files might have changed
diff --git a/mobile/apps/photos/lib/ui/viewer/file/file_bottom_bar.dart b/mobile/apps/photos/lib/ui/viewer/file/file_bottom_bar.dart
index 8ca05a9665..b258013dd8 100644
--- a/mobile/apps/photos/lib/ui/viewer/file/file_bottom_bar.dart
+++ b/mobile/apps/photos/lib/ui/viewer/file/file_bottom_bar.dart
@@ -491,13 +491,9 @@ class FileBottomBarState extends State<FileBottomBar> {
fileID: fileID,
);
}
- } catch (e, s) {
+ } catch (e) {
failedCount++;
- _logger.warning(
- "Failed to unlike from ${collection.displayName}",
- e,
- s,
- );
+ debugPrint("Failed to unlike from ${collection.displayName}: $e");
}
}
@@ -507,9 +503,9 @@ class FileBottomBarState extends State<FileBottomBar> {
safeRefresh();
showShortToast(context, "Failed to unlike photo");
}
- } catch (e, s) {
+ } catch (e) {
// Rollback on error (e.g., fetching collections failed)
- _logger.warning("Failed to unlike from all collections", e, s);
+ debugPrint("Failed to unlike from all collections: $e");
if (mounted) {
_hasLiked = previousState;
safeRefresh();
diff --git a/mobile/apps/photos/lib/ui/viewer/file/file_details_widget.dart b/mobile/apps/photos/lib/ui/viewer/file/file_details_widget.dart
index a427cef1be..f691744a1f 100644
--- a/mobile/apps/photos/lib/ui/viewer/file/file_details_widget.dart
+++ b/mobile/apps/photos/lib/ui/viewer/file/file_details_widget.dart
@@ -77,7 +77,7 @@ class _FileDetailsWidgetState extends State<FileDetailsWidget> {
@override
void initState() {
- _logger.info('file_details_sheet initState');
+ debugPrint('file_details_sheet initState');
_currentUserID = Configuration.instance.getUserIDV2();
hasLocationData.value = widget.file.hasLocation;
_isImage =
@@ -412,7 +412,7 @@ class _FileDetailsWidgetState extends State<FileDetailsWidget> {
final double roundedMegaPixels = (megaPixels * 10).round() / 10.0;
_exifData['megaPixels'] = roundedMegaPixels..toStringAsFixed(1);
} else {
- _logger.info("No image width/height");
+ debugPrint("No image width/height");
}
if (exif["Image Make"] != null && exif["Image Model"] != null) {
_exifData["takenOnDevice"] =
diff --git a/mobile/apps/photos/lib/ui/viewer/file/ocr/display_image_helper.dart b/mobile/apps/photos/lib/ui/viewer/file/ocr/display_image_helper.dart
index 377db17fb9..56bcfbb751 100644
--- a/mobile/apps/photos/lib/ui/viewer/file/ocr/display_image_helper.dart
+++ b/mobile/apps/photos/lib/ui/viewer/file/ocr/display_image_helper.dart
@@ -1,13 +1,11 @@
import 'package:flutter/foundation.dart';
import 'package:flutter/services.dart';
-import "package:logging/logging.dart";
/// Internal helper that asks the native side to produce a Flutter-friendly
/// image path for formats (e.g. HEIC) that some decoders can't render.
class DisplayImageHelper {
DisplayImageHelper._();
- static final Logger _logger = Logger("DisplayImageHelper");
static const MethodChannel _channel = MethodChannel('mobile_ocr');
static final Map<String, String> _cache = <String, String>{};
static final Map<String, Future<String>> _inFlight =
@@ -41,7 +39,8 @@ class DisplayImageHelper {
_cache[imagePath] = result;
return result;
} catch (error, stack) {
- _logger.warning('Failed to normalize image $imagePath', error, stack);
+ debugPrint('Failed to normalize image $imagePath: $error');
+ debugPrintStack(stackTrace: stack);
return imagePath;
} finally {
final _ = _inFlight.remove(imagePath);
diff --git a/mobile/apps/photos/lib/ui/viewer/file/ocr/text_detector_widget.dart b/mobile/apps/photos/lib/ui/viewer/file/ocr/text_detector_widget.dart
index dcbc146930..dd9d866707 100644
--- a/mobile/apps/photos/lib/ui/viewer/file/ocr/text_detector_widget.dart
+++ b/mobile/apps/photos/lib/ui/viewer/file/ocr/text_detector_widget.dart
@@ -3,7 +3,6 @@ import 'dart:io';
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
-import "package:logging/logging.dart";
import 'package:mobile_ocr/mobile_ocr_plugin.dart';
import 'package:mobile_ocr/models/text_block.dart';
import 'package:photos/ui/viewer/file/ocr/display_image_helper.dart';
@@ -206,8 +205,6 @@ class TextDetectorWidget extends StatefulWidget {
}
class _TextDetectorWidgetState extends State<TextDetectorWidget> {
- final _logger = Logger("_TextDetectorWidgetState");
-
final MobileOcr _ocr = MobileOcr();
final TextOverlayController _textOverlayController = TextOverlayController();
List<TextBlock>? _detectedTextBlocks;
@@ -298,12 +295,8 @@ class _TextDetectorWidgetState extends State<TextDetectorWidget> {
if (widget.autoDetect || widget.initialInteractionPosition != null) {
unawaited(_detectText());
}
- } catch (error, stackTrace) {
- _logger.warning(
- 'Failed to prepare image $requestedPath',
- error,
- stackTrace,
- );
+ } catch (error) {
+ debugPrint('Failed to prepare image $requestedPath: $error');
if (!mounted || widget.imagePath != requestedPath) {
return;
}
@@ -360,7 +353,7 @@ class _TextDetectorWidgetState extends State<TextDetectorWidget> {
} else {
_errorMessage = widget.strings.modelsPrepareFailed;
}
- _logger.warning('Model preparation error', error);
+ debugPrint('Model preparation error: $error');
})
.whenComplete(() {
_modelPreparation = null;
@@ -427,8 +420,8 @@ class _TextDetectorWidgetState extends State<TextDetectorWidget> {
_textOverlayController.selectTextAtPosition(pendingPos);
}
}
- } catch (e, stackTrace) {
- _logger.warning('Error detecting text', e, stackTrace);
+ } catch (e) {
+ debugPrint('Error detecting text: $e');
if (mounted && widget.imagePath == requestedPath) {
setState(() {
// Show user-friendly message based on error type
diff --git a/mobile/apps/photos/lib/ui/viewer/gallery/gallery_app_bar_widget.dart b/mobile/apps/photos/lib/ui/viewer/gallery/gallery_app_bar_widget.dart
index cf4337e5d8..506cdea564 100644
--- a/mobile/apps/photos/lib/ui/viewer/gallery/gallery_app_bar_widget.dart
+++ b/mobile/apps/photos/lib/ui/viewer/gallery/gallery_app_bar_widget.dart
@@ -1055,7 +1055,7 @@ class _GalleryAppBarWidgetState extends State<GalleryAppBarWidget> {
if (result == true) {
Navigator.of(context).pop();
} else {
- _logger.info("No pop");
+ debugPrint("No pop");
}
}
}
diff --git a/mobile/apps/photos/lib/ui/viewer/people/person_cluster_suggestion.dart b/mobile/apps/photos/lib/ui/viewer/people/person_cluster_suggestion.dart
index 0d47c54b65..03231f34c3 100644
--- a/mobile/apps/photos/lib/ui/viewer/people/person_cluster_suggestion.dart
+++ b/mobile/apps/photos/lib/ui/viewer/people/person_cluster_suggestion.dart
@@ -374,7 +374,7 @@ class _PersonClustersState extends State<PersonReviewClusterSuggestion> {
// Method to fetch cluster suggestions
void _fetchClusterSuggestions() {
- _logger.info("Fetching suggestions for ${widget.person.data.name}");
+ debugPrint("Fetching suggestions for ${widget.person.data.name}");
futureClusterSuggestions = ClusterFeedbackService.instance
.getSuggestionForPerson(widget.person);
}
@@ -539,9 +539,7 @@ class _PersonClustersState extends State<PersonReviewClusterSuggestion> {
);
compCount += computeHere;
if (compCount >= maxPrecomputations) {
- _logger.info(
- 'Prefetching $compCount face thumbnails for suggestions',
- );
+ debugPrint('Prefetching $compCount face thumbnails for suggestions');
break outerLoop;
}
}
diff --git a/mobile/apps/photos/lib/ui/viewer/search/search_widget.dart b/mobile/apps/photos/lib/ui/viewer/search/search_widget.dart
index 69fbfa8b24..6d6e8f7659 100644
--- a/mobile/apps/photos/lib/ui/viewer/search/search_widget.dart
+++ b/mobile/apps/photos/lib/ui/viewer/search/search_widget.dart
@@ -74,7 +74,7 @@ class SearchWidgetState extends State<SearchWidget> {
_tabDoubleTapEvent = Bus.instance.on<TabDoubleTapEvent>().listen((
event,
) async {
- _logger.info("Firing now ${event.selectedIndex}");
+ debugPrint("Firing now ${event.selectedIndex}");
if (mounted && event.selectedIndex == 3) {
focusNode.requestFocus();
}
diff --git a/mobile/apps/photos/lib/utils/face/face_thumbnail_cache.dart b/mobile/apps/photos/lib/utils/face/face_thumbnail_cache.dart
index 1ba81650b3..f915a434ff 100644
--- a/mobile/apps/photos/lib/utils/face/face_thumbnail_cache.dart
+++ b/mobile/apps/photos/lib/utils/face/face_thumbnail_cache.dart
@@ -289,7 +289,7 @@ Future<Uint8List?> precomputeClusterFaceCrop(
);
w?.log('getCoverFaceForPerson');
if (face == null) {
- _logger.info(
+ debugPrint(
"No cover face for cluster $clusterID and recentFile ${file.uploadedFileID}",
);
return null;
diff --git a/mobile/apps/photos/lib/utils/file_download_util.dart b/mobile/apps/photos/lib/utils/file_download_util.dart
index 8f71f7b494..8299672e50 100644
--- a/mobile/apps/photos/lib/utils/file_download_util.dart
+++ b/mobile/apps/photos/lib/utils/file_download_util.dart
@@ -442,7 +442,7 @@ Future<void> _saveLivePhotoOnDroid(
File video,
EnteFile enteFile,
) async {
- _logger.info("Downloading LivePhoto on Droid");
+ debugPrint("Downloading LivePhoto on Droid");
final imageTitle = _getGallerySaveTitle(enteFile, image.path);
AssetEntity? savedAsset =
await (PhotoManager.editor.saveImageWithPath(
diff --git a/mobile/apps/photos/lib/utils/file_uploader.dart b/mobile/apps/photos/lib/utils/file_uploader.dart
index 45372e4f91..2bc0b6d123 100644
--- a/mobile/apps/photos/lib/utils/file_uploader.dart
+++ b/mobile/apps/photos/lib/utils/file_uploader.dart
@@ -196,7 +196,7 @@ class FileUploader {
_totalCountInUploadSession--;
return item.completer.future;
}
- _logger.info(
+ debugPrint(
"Wait on another upload on same local ID to finish before "
"adding it to new collection",
);
@@ -644,7 +644,7 @@ class FileUploader {
);
final isMappedToExistingUpload = result.item1;
if (isMappedToExistingUpload) {
- _logger.info(
+ debugPrint(
"File success mapped to existing uploaded ${file.toString()}",
);
// treat as completed so _onUploadDone clears the source export
diff --git a/mobile/apps/photos/lib/utils/file_util.dart b/mobile/apps/photos/lib/utils/file_util.dart
index 196f300a20..c78644221a 100644
--- a/mobile/apps/photos/lib/utils/file_util.dart
+++ b/mobile/apps/photos/lib/utils/file_util.dart
@@ -342,7 +342,7 @@ Future<_LivePhoto?> _downloadLivePhoto(
if (imageFileCache != null && videoFileCache != null) {
return _LivePhoto(imageFileCache, videoFileCache);
} else {
- _logger.warning(
+ debugPrint(
"Warning: ${file.tag} either image ${imageFileCache == null} or video ${videoFileCache == null} is missing from remoteLive",
);
return null;
diff --git a/mobile/apps/photos/plugins/ente_cast/lib/src/service.dart b/mobile/apps/photos/plugins/ente_cast/lib/src/service.dart
index 8c8987e538..55b39daef9 100644
--- a/mobile/apps/photos/plugins/ente_cast/lib/src/service.dart
+++ b/mobile/apps/photos/plugins/ente_cast/lib/src/service.dart
@@ -1,14 +1,13 @@
import "dart:async";
+import "dart:developer" as dev;
import "dart:io";
import "package:cast/cast.dart";
import "package:ente_cast/src/model.dart";
import "package:flutter/foundation.dart";
import "package:flutter/material.dart";
-import "package:logging/logging.dart";
class CastService {
- final _logger = Logger("CastService");
final String _appId = "F5BCEC64";
final String _pairRequestNamespace = "urn:x-cast:pair-request";
@@ -40,27 +39,30 @@ class CastService {
session.messageStream.listen((message) {
if (message["type"] == "RECEIVER_STATUS") {
- _logger.info("got RECEIVER_STATUS, Send request to pair");
+ dev.log(
+ "got RECEIVER_STATUS, Send request to pair",
+ name: "CastService",
+ );
session.sendMessage(_pairRequestNamespace, {
"collectionID": collectionID,
});
} else if (onMessage != null && message.containsKey("code")) {
onMessage({CastMessageType.pairCode: message});
} else if (kDebugMode) {
- _logger.info("receive message: $message");
+ print("receive message: $message");
}
});
session.stateStream.listen((state) {
if (state == CastSessionState.connected) {
- _logger.info("Send request to pair");
+ debugPrint("Send request to pair");
session.sendMessage(_pairRequestNamespace, {});
} else if (state == CastSessionState.closed) {
- _logger.info("Session closed");
+ dev.log("Session closed", name: "CastService");
}
});
- _logger.info("Send request to launch");
+ debugPrint("Send request to launch");
session.sendMessage(CastSession.kNamespaceReceiver, {
"type": "LAUNCH",
"appId": _appId,
@@ -74,7 +76,7 @@ class CastService {
final sessions = CastSessionManager().sessions;
for (final session in sessions) {
- _logger.info("send close message for ${session.sessionId}");
+ debugPrint("send close message for ${session.sessionId}");
unawaited(
Future(() {
session.sendMessage(CastSession.kNamespaceConnection, {
@@ -83,11 +85,11 @@ class CastService {
}).timeout(
const Duration(seconds: 5),
onTimeout: () {
- _logger.warning("sendMessage timed out after 5 seconds");
+ debugPrint("sendMessage timed out after 5 seconds");
},
),
);
- _logger.info("close session ${session.sessionId}");
+ debugPrint("close session ${session.sessionId}");
unawaited(session.close());
}
CastSessionManager().sessions.clear();
diff --git a/mobile/apps/photos/plugins/ente_cast/pubspec.yaml b/mobile/apps/photos/plugins/ente_cast/pubspec.yaml
index 62e2d4e6b8..181e226eea 100644
--- a/mobile/apps/photos/plugins/ente_cast/pubspec.yaml
+++ b/mobile/apps/photos/plugins/ente_cast/pubspec.yaml
@@ -13,7 +13,6 @@ dependencies:
dio: 5.9.2
flutter:
sdk: flutter
- logging: 1.3.0
dev_dependencies:
flutter_lints: 6.0.0
diff --git a/mobile/apps/photos/plugins/ente_crypto/lib/src/crypto.dart b/mobile/apps/photos/plugins/ente_crypto/lib/src/crypto.dart
index 6d8e1a4d66..63d0f44be1 100644
--- a/mobile/apps/photos/plugins/ente_crypto/lib/src/crypto.dart
+++ b/mobile/apps/photos/plugins/ente_crypto/lib/src/crypto.dart
@@ -8,6 +8,7 @@ import "package:crypto/crypto.dart";
import "package:ente_crypto/src/models/derived_key_result.dart";
import "package:ente_crypto/src/models/encryption_result.dart";
import "package:ente_crypto/src/models/errors.dart";
+import "package:flutter/foundation.dart";
import "package:flutter_sodium/flutter_sodium.dart";
import "package:logging/logging.dart";
@@ -408,7 +409,7 @@ Future<FileEncryptResult> chachaEncryptFileWithVerification(
final partsInfo = multiPartChunkSizeInBytes != null
? " Parts: ${partMd5s.length}"
: "";
- logger.info(
+ debugPrint(
"FileEncryption: Time: ${encryptionTimeSeconds}s "
"Total encrypted: $totalEncryptedBytes bytes$partsInfo",
);
diff --git a/mobile/apps/photos/plugins/ente_feature_flag/lib/src/service.dart b/mobile/apps/photos/plugins/ente_feature_flag/lib/src/service.dart
index 120e7210e9..7d215b7b87 100644
--- a/mobile/apps/photos/plugins/ente_feature_flag/lib/src/service.dart
+++ b/mobile/apps/photos/plugins/ente_feature_flag/lib/src/service.dart
@@ -2,18 +2,16 @@
import "dart:async";
import "dart:convert";
+import "dart:developer";
import "dart:io";
import "package:dio/dio.dart";
import "package:flutter/foundation.dart";
-import "package:logging/logging.dart";
import "package:shared_preferences/shared_preferences.dart";
import "model.dart";
class FlagService {
- final _logger = Logger("FlagService");
-
static const int _commentsFlag = 1 << 1;
static const int _videoStreamingFlag = 1 << 3;
static const int _castSessionsV2Flag = 1 << 5;
@@ -41,8 +39,8 @@ class FlagService {
jsonDecode(_prefs.getString("remote_flags") ?? "{}"),
);
return _flags!;
- } catch (e, s) {
- _logger.warning("Failed to get feature flags", e, s);
+ } catch (e) {
+ debugPrint("Failed to get feature flags $e");
return RemoteFlags.defaultValue;
}
}
@@ -132,8 +130,8 @@ class FlagService {
Future<void> tryRefreshFlags() async {
try {
await _fetch();
- } catch (e, s) {
- _logger.warning("Failed to refresh flags", e, s);
+ } catch (e) {
+ debugPrint("Failed to refresh flags: $e");
}
}
@@ -159,7 +157,7 @@ class FlagService {
Completer<void>? _fetchCompleter;
Future<void> _fetch() async {
if (!_prefs.containsKey("token")) {
- _logger.info("token not found, skip");
+ log("token not found, skip", name: "FlagService");
return;
}
if (_fetchCompleter != null) {
@@ -168,13 +166,13 @@ class FlagService {
}
_fetchCompleter = Completer<void>();
try {
- _logger.info("fetching feature flags");
+ log("fetching feature flags", name: "FlagService");
final response = await _enteDio.get("/remote-store/feature-flags");
final remoteFlags = RemoteFlags.fromMap(response.data);
await _prefs.setString("remote_flags", remoteFlags.toJson());
_flags = remoteFlags;
- } catch (e, s) {
- _logger.warning("Failed to sync feature flags", e, s);
+ } catch (e) {
+ debugPrint("Failed to sync feature flags $e");
} finally {
_fetchCompleter?.complete();
_fetchCompleter = null;
@@ -190,8 +188,8 @@ class FlagService {
if (response.statusCode != HttpStatus.ok) {
throw Exception("Unexpected state");
}
- } catch (e, s) {
- _logger.warning("Failed to set flag for $key", e, s);
+ } catch (e) {
+ debugPrint("Failed to set flag for $key $e");
rethrow;
}
}
diff --git a/mobile/apps/photos/plugins/ente_feature_flag/pubspec.yaml b/mobile/apps/photos/plugins/ente_feature_flag/pubspec.yaml
index a59036ac20..786acce6f6 100644
--- a/mobile/apps/photos/plugins/ente_feature_flag/pubspec.yaml
+++ b/mobile/apps/photos/plugins/ente_feature_flag/pubspec.yaml
@@ -9,7 +9,6 @@ dependencies:
dio: 5.9.2
flutter:
sdk: flutter
- logging: 1.3.0
shared_preferences: 2.5.3
dev_dependencies:
diff --git a/mobile/apps/photos/rust_builder/cargokit/build_tool/lib/src/build_tool.dart b/mobile/apps/photos/rust_builder/cargokit/build_tool/lib/src/build_tool.dart
index 5f5489558c..f0e4fd7f5b 100644
--- a/mobile/apps/photos/rust_builder/cargokit/build_tool/lib/src/build_tool.dart
+++ b/mobile/apps/photos/rust_builder/cargokit/build_tool/lib/src/build_tool.dart
@@ -81,8 +81,6 @@ class BuildCMakeCommand extends BuildCommand {
}
class GenKeyCommand extends Command {
- final _logger = Logger("GenKeyCommand");
-
@override
final name = 'gen-key';
@@ -94,8 +92,8 @@ class GenKeyCommand extends Command {
final kp = generateKey();
final private = HEX.encode(kp.privateKey.bytes);
final public = HEX.encode(kp.publicKey.bytes);
- _logger.info("Private Key: $private");
- _logger.info("Public Key: $public");
+ print("Private Key: $private");
+ print("Public Key: $public");
}
}