TF-4136 refactor(logging): replace logError with logWarning for non-critical cases

This commit is contained in:
dab246
2026-01-02 12:18:38 +07:00
committed by Dat H. Pham
parent 73dcb6067c
commit a23d15a9ca
160 changed files with 382 additions and 360 deletions
+17 -14
View File
@@ -143,7 +143,7 @@ abstract class BaseController extends GetxController
}
void onError(dynamic error, StackTrace stackTrace) {
logError('$runtimeType::onError():Error: $error | StackTrace: $stackTrace');
logWarning('$runtimeType::onError():Error: $error | StackTrace: $stackTrace');
final isUrgentException = validateUrgentException(error);
if (isUrgentException) {
handleUrgentException(exception: error);
@@ -173,7 +173,7 @@ abstract class BaseController extends GetxController
}
void handleUrgentExceptionOnMobile({Failure? failure, Exception? exception}) {
logError('$runtimeType::handleUrgentExceptionOnMobile():Failure: $failure | Exception: $exception');
logWarning('$runtimeType::handleUrgentExceptionOnMobile():Failure: $failure | Exception: $exception');
if (exception is ConnectionError) {
_handleConnectionErrorException();
} else if (exception is BadCredentialsException) {
@@ -182,7 +182,7 @@ abstract class BaseController extends GetxController
}
void handleUrgentExceptionOnWeb({Failure? failure, Exception? exception}) {
logError('$runtimeType::handleUrgentExceptionOnWeb():Failure: $failure | Exception: $exception');
logWarning('$runtimeType::handleUrgentExceptionOnWeb():Failure: $failure | Exception: $exception');
if (exception is NoNetworkError) {
_handleNotNetworkErrorException();
} else if (exception is ConnectionError) {
@@ -258,7 +258,7 @@ abstract class BaseController extends GetxController
}
void handleFailureViewState(Failure failure) async {
logError('$runtimeType::handleFailureViewState():Failure = $failure');
logWarning('$runtimeType::handleFailureViewState():Failure = $failure');
if (failure is LogoutOidcFailure) {
if (_isFcmEnabled) {
_getStoredFirebaseRegistrationFromCache();
@@ -313,7 +313,7 @@ abstract class BaseController extends GetxController
requireCapability(session!, accountId!, [tmailContactCapabilityIdentifier]);
TMailAutoCompleteBindings().dependencies();
} catch (e) {
logError('$runtimeType::injectAutoCompleteBindings(): exception: $e');
logWarning('$runtimeType::injectAutoCompleteBindings(): exception: $e');
}
}
@@ -322,7 +322,7 @@ abstract class BaseController extends GetxController
requireCapability(session!, accountId!, [CapabilityIdentifier.jmapMdn]);
MdnInteractorBindings().dependencies();
} catch(e) {
logError('$runtimeType::injectMdnBindings(): exception: $e');
logWarning('$runtimeType::injectMdnBindings(): exception: $e');
}
}
@@ -331,7 +331,7 @@ abstract class BaseController extends GetxController
requireCapability(session!, accountId!, [capabilityForward]);
ForwardingInteractorsBindings().dependencies();
} catch(e) {
logError('$runtimeType::injectForwardBindings(): exception: $e');
logWarning('$runtimeType::injectForwardBindings(): exception: $e');
}
}
@@ -340,7 +340,7 @@ abstract class BaseController extends GetxController
requireCapability(session!, accountId!, [capabilityRuleFilter]);
EmailRulesInteractorBindings().dependencies();
} catch(e) {
logError('$runtimeType::injectRuleFilterBindings(): exception: $e');
logWarning('$runtimeType::injectRuleFilterBindings(): exception: $e');
}
}
@@ -362,7 +362,7 @@ abstract class BaseController extends GetxController
throw NotSupportFCMException();
}
} catch(e) {
logError('$runtimeType::injectFCMBindings(): exception: $e');
logWarning('$runtimeType::injectFCMBindings(): exception: $e');
}
}
@@ -386,7 +386,7 @@ abstract class BaseController extends GetxController
WebSocketInteractorBindings().dependencies();
WebSocketController.instance.initialize(accountId: accountId, session: session);
} catch(e) {
logError('$runtimeType::injectWebSocket(): exception: $e');
logWarning('$runtimeType::injectWebSocket(): exception: $e');
}
}
@@ -491,7 +491,7 @@ abstract class BaseController extends GetxController
onSuccessCallback();
}
} catch (e) {
logError('BaseController::logoutToSignInNewAccount:Exception = $e');
logWarning('BaseController::logoutToSignInNewAccount:Exception = $e');
onFailureCallback();
}
}
@@ -510,8 +510,11 @@ abstract class BaseController extends GetxController
}
Future<void> _handleDeleteFCMRegistration() async {
_getStoredFirebaseRegistrationInteractor =
getBinding<GetStoredFirebaseRegistrationInteractor>();
if (_getStoredFirebaseRegistrationInteractor == null) return;
try {
_getStoredFirebaseRegistrationInteractor = getBinding<GetStoredFirebaseRegistrationInteractor>();
final fcmRegistration = await _getStoredFirebaseRegistrationInteractor?.execute().last;
fcmRegistration?.foldSuccess<GetStoredFirebaseRegistrationSuccess>(
@@ -522,7 +525,7 @@ abstract class BaseController extends GetxController
onFailure: (failure) {},
);
} catch (e) {
logError('BaseController::_handleDeleteFCMRegistration:Exception = $e');
logWarning('BaseController::_handleDeleteFCMRegistration:Exception = $e');
}
}
@@ -563,7 +566,7 @@ abstract class BaseController extends GetxController
await _clearBasicAuthData();
}
} catch (e) {
logError('BaseController::clearAllData:Exception = $e');
logWarning('BaseController::clearAllData:Exception = $e');
}
}
@@ -19,6 +19,6 @@ class BeforeReconnectManager {
Future<void> executeBeforeReconnectListeners() async {
await Future.wait(_listeners.map((listener) => listener.call()))
.onError((error, stackTrace) => [logError(error.toString())]);
.onError((error, stackTrace) => [logWarning(error.toString())]);
}
}
@@ -21,7 +21,7 @@ abstract class IsolateManager {
IsolateNameServer.registerPortWithName(_eventReceivePort.sendPort, isolateIdentityName);
_streamSubscription = _eventReceivePort.listen(onData, onError: onError, onDone: onDone);
} catch (e) {
logError('IsolateManager::initial():EXCEPTION: $e');
logWarning('IsolateManager::initial():EXCEPTION: $e');
}
}
@@ -32,10 +32,10 @@ abstract class IsolateManager {
if (sendPort != null) {
sendPort.send(value);
} else {
logError('IsolateManager::addEvent(): sendPort is null');
logWarning('IsolateManager::addEvent(): sendPort is null');
}
} catch (e) {
logError('IsolateManager::addEvent():EXCEPTION: $e');
logWarning('IsolateManager::addEvent():EXCEPTION: $e');
}
}
@@ -42,7 +42,7 @@ mixin HandleSetErrorMixin {
handlers!.firstWhere((handler) => handler.call(setError));
return const None<MapEntry<Id, SetError>>();
} catch (e) {
logError('HandleSetErrorMixin::chainHandle(): [Exception] $e');
logWarning('HandleSetErrorMixin::chainHandle(): [Exception] $e');
return Some<MapEntry<Id, SetError>>(setError);
}
}
@@ -50,7 +50,7 @@ mixin HandleSetErrorMixin {
void _handleRemainedError(SetMethodErrorHandler? unCatchErrorHandler, Option<MapEntry<Id, SetError>> optionError) {
final remainedError = optionError.toNullable();
if (remainedError != null) {
logError('HandleSetErrorMixin::_handleRemainedError(): $remainedError');
logWarning('HandleSetErrorMixin::_handleRemainedError(): $remainedError');
unCatchErrorHandler?.call(remainedError);
}
}
@@ -73,7 +73,7 @@ mixin HandleSetErrorMixin {
}
);
}
logError('HandleSetErrorMixin::handleSetResponse():remainedErrors: $remainedErrors');
logWarning('HandleSetErrorMixin::handleSetResponse():remainedErrors: $remainedErrors');
return remainedErrors;
}
}
@@ -1,8 +1,8 @@
import 'package:core/utils/app_logger.dart';
import 'package:core/utils/platform_info.dart';
import 'package:core/utils/string_convert.dart';
import 'package:external_app_launcher/external_app_launcher.dart';
import 'package:rich_text_composer/views/commons/logger.dart';
import 'package:url_launcher/url_launcher.dart' as launcher;
mixin LauncherApplicationMixin {
@@ -28,7 +28,7 @@ mixin LauncherApplicationMixin {
await openOtherApplication(uri);
}
} catch (e) {
logError('LauncherApplicationMixin::launchApplication:Exception = $e');
logWarning('LauncherApplicationMixin::launchApplication:Exception = $e');
}
}
@@ -33,13 +33,13 @@ abstract class ReloadableController extends BaseController {
@override
void handleFailureViewState(Failure failure) {
if (isNotSignedIn(failure)) {
logError('$runtimeType::handleFailureViewState():Failure = $failure');
logWarning('$runtimeType::handleFailureViewState():Failure = $failure');
goToLogin();
} else if (failure is GetSessionFailure) {
logError('$runtimeType::handleFailureViewState():Failure = $failure');
logWarning('$runtimeType::handleFailureViewState():Failure = $failure');
handleGetSessionFailure(failure);
} else if (failure is UpdateAccountCacheFailure) {
logError('$runtimeType::handleFailureViewState():Failure = $failure');
logWarning('$runtimeType::handleFailureViewState():Failure = $failure');
_handleUpdateAccountCacheCompleted(
session: failure.session,
apiUrl: failure.apiUrl);
@@ -153,7 +153,7 @@ abstract class ReloadableController extends BaseController {
requireCapability(session!, accountId!, [CapabilityIdentifier.jmapVacationResponse]);
VacationInteractorsBindings().dependencies();
} catch(e) {
logError('$runtimeType::injectVacationBindings(): exception: $e');
logWarning('$runtimeType::injectVacationBindings(): exception: $e');
}
}