mirror of
https://github.com/twonlyapp/twonly-app.git
synced 2026-01-15 16:28:40 +00:00
improve logging
This commit is contained in:
parent
9cb2503cdb
commit
108a58ffe1
7 changed files with 10 additions and 18 deletions
|
|
@ -185,7 +185,7 @@ class ApiService {
|
||||||
}
|
}
|
||||||
|
|
||||||
Future<void> _onError(dynamic e) async {
|
Future<void> _onError(dynamic e) async {
|
||||||
Log.error('websocket error: $e');
|
Log.warn('websocket error: $e');
|
||||||
await onClosed();
|
await onClosed();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -206,7 +206,7 @@ class ApiService {
|
||||||
Future<server.ServerToClient?> _waitForResponse(Int64 seq) async {
|
Future<server.ServerToClient?> _waitForResponse(Int64 seq) async {
|
||||||
final startTime = DateTime.now();
|
final startTime = DateTime.now();
|
||||||
|
|
||||||
const timeout = Duration(seconds: 20);
|
const timeout = Duration(seconds: 60);
|
||||||
|
|
||||||
while (true) {
|
while (true) {
|
||||||
if (messagesV0[seq] != null) {
|
if (messagesV0[seq] != null) {
|
||||||
|
|
@ -215,7 +215,7 @@ class ApiService {
|
||||||
return tmp;
|
return tmp;
|
||||||
}
|
}
|
||||||
if (DateTime.now().difference(startTime) > timeout) {
|
if (DateTime.now().difference(startTime) > timeout) {
|
||||||
Log.error('Timeout for message $seq');
|
Log.warn('Timeout for message $seq');
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
await Future.delayed(const Duration(milliseconds: 10));
|
await Future.delayed(const Duration(milliseconds: 10));
|
||||||
|
|
@ -417,7 +417,7 @@ class ApiService {
|
||||||
|
|
||||||
final result = await sendRequestSync(req, authenticated: false);
|
final result = await sendRequestSync(req, authenticated: false);
|
||||||
if (result.isError) {
|
if (result.isError) {
|
||||||
Log.error('could not request auth challenge', result);
|
Log.warn('could not request auth challenge', result);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -112,7 +112,6 @@ Future<void> handleDownloadStatusUpdate(TaskStatusUpdate update) async {
|
||||||
}
|
}
|
||||||
|
|
||||||
if (failed) {
|
if (failed) {
|
||||||
Log.error('Background media upload failed: ${update.status}');
|
|
||||||
await requestMediaReupload(mediaId);
|
await requestMediaReupload(mediaId);
|
||||||
} else {
|
} else {
|
||||||
await handleEncryptedFile(mediaId);
|
await handleEncryptedFile(mediaId);
|
||||||
|
|
|
||||||
|
|
@ -35,11 +35,7 @@ class MediaFileService {
|
||||||
|
|
||||||
final service = await MediaFileService.fromMediaId(mediaId);
|
final service = await MediaFileService.fromMediaId(mediaId);
|
||||||
|
|
||||||
if (service == null) {
|
if (service != null) {
|
||||||
Log.error(
|
|
||||||
'Purging media file, as it is not in the database $mediaId.',
|
|
||||||
);
|
|
||||||
} else {
|
|
||||||
if (service.mediaFile.isDraftMedia) {
|
if (service.mediaFile.isDraftMedia) {
|
||||||
delete = false;
|
delete = false;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -112,7 +112,7 @@ Future<(EncryptedContent?, PlaintextContent_DecryptionErrorMessage_Type?)>
|
||||||
|
|
||||||
return (EncryptedContent.fromBuffer(plaintext), null);
|
return (EncryptedContent.fromBuffer(plaintext), null);
|
||||||
} on InvalidKeyIdException catch (e) {
|
} on InvalidKeyIdException catch (e) {
|
||||||
Log.error(e);
|
Log.warn(e);
|
||||||
return (null, PlaintextContent_DecryptionErrorMessage_Type.PREKEY_UNKNOWN);
|
return (null, PlaintextContent_DecryptionErrorMessage_Type.PREKEY_UNKNOWN);
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
Log.error(e);
|
Log.error(e);
|
||||||
|
|
|
||||||
|
|
@ -50,8 +50,7 @@ Future<void> requestNewPrekeysForContact(int contactId) async {
|
||||||
.toList();
|
.toList();
|
||||||
await twonlyDB.signalDao.insertPreKeys(preKeys);
|
await twonlyDB.signalDao.insertPreKeys(preKeys);
|
||||||
} else {
|
} else {
|
||||||
// 104400
|
Log.warn('[PREKEY] Could not load new pre keys for user $contactId');
|
||||||
Log.error('[PREKEY] Could not load new pre keys for user $contactId');
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
@ -85,7 +84,7 @@ Future<void> requestNewSignedPreKeyForContact(int contactId) async {
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
} else {
|
} else {
|
||||||
Log.error('could not load new signed pre key for user $contactId');
|
Log.warn('could not load new signed pre key for user $contactId');
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -23,9 +23,9 @@ void initLogger() {
|
||||||
|
|
||||||
class Log {
|
class Log {
|
||||||
static String filterLogMessage(String msg) {
|
static String filterLogMessage(String msg) {
|
||||||
if (msg.contains("SqliteException")) {
|
if (msg.contains('SqliteException')) {
|
||||||
// Do not log data which would be inserted into the DB.
|
// Do not log data which would be inserted into the DB.
|
||||||
return msg.substring(0, msg.indexOf("parameters: "));
|
return msg.substring(0, msg.indexOf('parameters: '));
|
||||||
}
|
}
|
||||||
return msg;
|
return msg;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -6,7 +6,6 @@ import 'dart:math';
|
||||||
import 'package:camera/camera.dart';
|
import 'package:camera/camera.dart';
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:twonly/globals.dart';
|
import 'package:twonly/globals.dart';
|
||||||
import 'package:twonly/src/utils/log.dart';
|
|
||||||
import 'package:twonly/src/views/camera/camera_preview_controller_view.dart';
|
import 'package:twonly/src/views/camera/camera_preview_controller_view.dart';
|
||||||
|
|
||||||
class CameraZoomButtons extends StatefulWidget {
|
class CameraZoomButtons extends StatefulWidget {
|
||||||
|
|
@ -51,7 +50,6 @@ class _CameraZoomButtonsState extends State<CameraZoomButtons> {
|
||||||
|
|
||||||
Future<void> initAsync() async {
|
Future<void> initAsync() async {
|
||||||
showWideAngleZoom = (await widget.controller.getMinZoomLevel()) < 1;
|
showWideAngleZoom = (await widget.controller.getMinZoomLevel()) < 1;
|
||||||
Log.info('Found ${gCameras.length} cameras for zoom.');
|
|
||||||
|
|
||||||
var index =
|
var index =
|
||||||
gCameras.indexWhere((t) => t.lensType == CameraLensType.ultraWide);
|
gCameras.indexWhere((t) => t.lensType == CameraLensType.ultraWide);
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue