Fix issue in logs

This commit is contained in:
Benoit Marty 2021-05-05 10:49:57 +02:00
parent 9e4f1147f4
commit 8d52829918
1 changed files with 8 additions and 8 deletions

View File

@ -224,7 +224,7 @@ internal class UploadContentWorker(val context: Context, params: WorkerParameter
val encryptedFile: File? val encryptedFile: File?
val contentUploadResponse = if (params.isEncrypted) { val contentUploadResponse = if (params.isEncrypted) {
Timber.v("## FileService: Encrypt file") Timber.v("## Encrypt file")
encryptedFile = File.createTempFile(UUID.randomUUID().toString(), null, context.cacheDir) encryptedFile = File.createTempFile(UUID.randomUUID().toString(), null, context.cacheDir)
.also { filesToDelete.add(it) } .also { filesToDelete.add(it) }
@ -236,18 +236,18 @@ internal class UploadContentWorker(val context: Context, params: WorkerParameter
} }
} }
Timber.v("## FileService: Uploading file") Timber.v("## Uploading file")
fileUploader fileUploader
.uploadFile(encryptedFile, attachment.name, MimeTypes.OctetStream, progressListener) .uploadFile(encryptedFile, attachment.name, MimeTypes.OctetStream, progressListener)
} else { } else {
Timber.v("## FileService: Clear file") Timber.v("## Clear file")
encryptedFile = null encryptedFile = null
fileUploader fileUploader
.uploadFile(fileToUpload, attachment.name, attachment.getSafeMimeType(), progressListener) .uploadFile(fileToUpload, attachment.name, attachment.getSafeMimeType(), progressListener)
} }
Timber.v("## FileService: Update cache storage for ${contentUploadResponse.contentUri}") Timber.v("## Update cache storage for ${contentUploadResponse.contentUri}")
try { try {
fileService.storeDataFor( fileService.storeDataFor(
mxcUrl = contentUploadResponse.contentUri, mxcUrl = contentUploadResponse.contentUri,
@ -256,9 +256,9 @@ internal class UploadContentWorker(val context: Context, params: WorkerParameter
originalFile = workingFile, originalFile = workingFile,
encryptedFile = encryptedFile encryptedFile = encryptedFile
) )
Timber.v("## FileService: cache storage updated") Timber.v("## cache storage updated")
} catch (failure: Throwable) { } catch (failure: Throwable) {
Timber.e(failure, "## FileService: Failed to update file cache") Timber.e(failure, "## Failed to update file cache")
} }
val uploadThumbnailResult = dealWithThumbnail(params) val uploadThumbnailResult = dealWithThumbnail(params)
@ -270,11 +270,11 @@ internal class UploadContentWorker(val context: Context, params: WorkerParameter
uploadThumbnailResult?.uploadedThumbnailEncryptedFileInfo, uploadThumbnailResult?.uploadedThumbnailEncryptedFileInfo,
newAttachmentAttributes) newAttachmentAttributes)
} catch (t: Throwable) { } catch (t: Throwable) {
Timber.e(t, "## FileService: ERROR ${t.localizedMessage}") Timber.e(t, "## ERROR ${t.localizedMessage}")
handleFailure(params, t) handleFailure(params, t)
} }
} catch (e: Exception) { } catch (e: Exception) {
Timber.e(e, "## FileService: ERROR") Timber.e(e, "## ERROR")
handleFailure(params, e) handleFailure(params, e)
} finally { } finally {
// Delete all temporary files // Delete all temporary files