Skip to content

Commit 162552d

Browse files
Removed redundant logger names.
1 parent af99d66 commit 162552d

File tree

2 files changed

+20
-24
lines changed

2 files changed

+20
-24
lines changed

demos/supabase-todolist/lib/attachments/queue.dart

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ Future<void> initializeAttachmentQueue(PowerSyncDatabase db) async {
1818
attachmentQueue = AttachmentQueue(
1919
db: db,
2020
remoteStorage: remoteStorage,
21+
logger: log,
2122
attachmentsDirectory: '${appDocDir.path}/attachments',
2223
watchAttachments: () => db.watch('''
2324
SELECT photo_id as id FROM todos WHERE photo_id IS NOT NULL

packages/powersync_attachments_stream/lib/src/sync/syncing_service.dart

Lines changed: 19 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -78,10 +78,7 @@ class SyncingService {
7878
await attachmentsService.withContext((context) async {
7979
final attachments = await context.getActiveAttachments();
8080
logger.info(
81-
'active attachments: ${attachments.map((e) => e.id).toList()}',
82-
);
83-
logger.info(
84-
'SyncingService: Found ${attachments.length} active attachments',
81+
'Found ${attachments.length} active attachments',
8582
);
8683
await handleSync(attachments, context);
8784
await deleteArchivedAttachments(context);
@@ -147,42 +144,42 @@ class SyncingService {
147144
AbstractAttachmentContext context,
148145
) async {
149146
logger.info(
150-
'SyncingService: Starting handleSync with ${attachments.length} attachments',
147+
'Starting handleSync with ${attachments.length} attachments',
151148
);
152149
final updatedAttachments = <Attachment>[];
153150

154151
for (final attachment in attachments) {
155152
logger.info(
156-
'SyncingService: Processing attachment ${attachment.id} with state: ${attachment.state}',
153+
'Processing attachment ${attachment.id} with state: ${attachment.state}',
157154
);
158155
try {
159156
switch (attachment.state) {
160157
case AttachmentState.queuedDownload:
161-
logger.info('SyncingService: Downloading [${attachment.filename}]');
158+
logger.info('Downloading [${attachment.filename}]');
162159
updatedAttachments.add(await downloadAttachment(attachment));
163160
break;
164161
case AttachmentState.queuedUpload:
165-
logger.info('SyncingService: Uploading [${attachment.filename}]');
162+
logger.info('Uploading [${attachment.filename}]');
166163
updatedAttachments.add(await uploadAttachment(attachment));
167164
break;
168165
case AttachmentState.queuedDelete:
169-
logger.info('SyncingService: Deleting [${attachment.filename}]');
166+
logger.info('Deleting [${attachment.filename}]');
170167
updatedAttachments.add(await deleteAttachment(attachment));
171168
break;
172169
case AttachmentState.synced:
173170
logger.info(
174-
'SyncingService: Attachment ${attachment.id} is already synced',
171+
'Attachment ${attachment.id} is already synced',
175172
);
176173
break;
177174
case AttachmentState.archived:
178175
logger.info(
179-
'SyncingService: Attachment ${attachment.id} is archived',
176+
'Attachment ${attachment.id} is archived',
180177
);
181178
break;
182179
}
183180
} catch (e, st) {
184181
logger.warning(
185-
'SyncingService: Error during sync for ${attachment.id}',
182+
'Error during sync for ${attachment.id}',
186183
e,
187184
st,
188185
);
@@ -191,7 +188,7 @@ class SyncingService {
191188

192189
if (updatedAttachments.isNotEmpty) {
193190
logger.info(
194-
'SyncingService: Saving ${updatedAttachments.length} updated attachments',
191+
'Saving ${updatedAttachments.length} updated attachments',
195192
);
196193
await context.saveAttachments(updatedAttachments);
197194
}
@@ -203,7 +200,7 @@ class SyncingService {
203200
/// Returns the updated attachment with its new state.
204201
Future<Attachment> uploadAttachment(Attachment attachment) async {
205202
logger.info(
206-
'SyncingService: Starting upload for attachment ${attachment.id}',
203+
'Starting upload for attachment ${attachment.id}',
207204
);
208205
try {
209206
if (attachment.localUri == null) {
@@ -214,23 +211,23 @@ class SyncingService {
214211
attachment,
215212
);
216213
logger.info(
217-
'SyncingService: Successfully uploaded attachment "${attachment.id}" to Cloud Storage',
214+
'Successfully uploaded attachment "${attachment.id}" to Cloud Storage',
218215
);
219216
return attachment.copyWith(
220217
state: AttachmentState.synced,
221218
hasSynced: true,
222219
);
223220
} catch (e, st) {
224221
logger.warning(
225-
'SyncingService: Upload attachment error for attachment $attachment',
222+
'Upload attachment error for attachment $attachment',
226223
e,
227224
st,
228225
);
229226
if (errorHandler != null) {
230227
final shouldRetry = await errorHandler!.onUploadError(attachment, e);
231228
if (!shouldRetry) {
232229
logger.info(
233-
'SyncingService: Attachment with ID ${attachment.id} has been archived',
230+
'Attachment with ID ${attachment.id} has been archived',
234231
);
235232
return attachment.copyWith(state: AttachmentState.archived);
236233
}
@@ -245,7 +242,7 @@ class SyncingService {
245242
/// Returns the updated attachment with its new state.
246243
Future<Attachment> downloadAttachment(Attachment attachment) async {
247244
logger.info(
248-
'SyncingService: Starting download for attachment ${attachment.id}',
245+
'Starting download for attachment ${attachment.id}',
249246
);
250247
final attachmentPath = await getLocalUri(attachment.filename);
251248
try {
@@ -255,11 +252,9 @@ class SyncingService {
255252
fileStream.map((chunk) => Uint8List.fromList(chunk)),
256253
);
257254
logger.info(
258-
'SyncingService: Successfully downloaded file "${attachment.id}"',
255+
'Successfully downloaded file "${attachment.id}"',
259256
);
260257

261-
logger.info('downloadAttachmentXY $attachment');
262-
263258
return attachment.copyWith(
264259
localUri: attachmentPath,
265260
state: AttachmentState.synced,
@@ -270,13 +265,13 @@ class SyncingService {
270265
final shouldRetry = await errorHandler!.onDownloadError(attachment, e);
271266
if (!shouldRetry) {
272267
logger.info(
273-
'SyncingService: Attachment with ID ${attachment.id} has been archived',
268+
'Attachment with ID ${attachment.id} has been archived',
274269
);
275270
return attachment.copyWith(state: AttachmentState.archived);
276271
}
277272
}
278273
logger.warning(
279-
'SyncingService: Download attachment error for attachment $attachment',
274+
'Download attachment error for attachment $attachment',
280275
e,
281276
st,
282277
);
@@ -291,7 +286,7 @@ class SyncingService {
291286
Future<Attachment> deleteAttachment(Attachment attachment) async {
292287
try {
293288
logger.info(
294-
'SyncingService: Deleting attachment ${attachment.id} from remote storage',
289+
'Deleting attachment ${attachment.id} from remote storage',
295290
);
296291
await remoteStorage.deleteFile(attachment);
297292

0 commit comments

Comments
 (0)