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
+1 -1
View File
@@ -62,7 +62,7 @@ class DeepLinksManager with OpenAppDeepLinkHandlerMixin {
return DeepLinkData(actionType: DeepLinkActionType.unknown);
}
} catch (e) {
logError('DeepLinksManager::parseDeepLink:Exception = $e');
logWarning('DeepLinksManager::parseDeepLink:Exception = $e');
return null;
}
}
@@ -1,10 +1,10 @@
import 'package:core/presentation/extensions/either_view_state_extension.dart';
import 'package:core/presentation/utils/theme_utils.dart';
import 'package:core/utils/app_logger.dart';
import 'package:core/utils/string_convert.dart';
import 'package:flutter/material.dart';
import 'package:get/get.dart';
import 'package:jmap_dart_client/jmap/core/user_name.dart';
import 'package:rich_text_composer/views/commons/logger.dart';
import 'package:tmail_ui_user/features/base/mixin/message_dialog_action_manager.dart';
import 'package:tmail_ui_user/features/home/domain/state/auto_sign_in_via_deep_link_state.dart';
import 'package:tmail_ui_user/features/home/domain/usecases/auto_sign_in_via_deep_link_interactor.dart';
@@ -42,7 +42,7 @@ mixin OpenAppDeepLinkHandlerMixin {
username: usernameDecoded,
);
} catch (e) {
logError('DeepLinksManager::parseOpenAppDeepLink:Exception = $e');
logWarning('DeepLinksManager::parseOpenAppDeepLink:Exception = $e');
return null;
}
}
@@ -106,7 +106,7 @@ mixin OpenAppDeepLinkHandlerMixin {
onFailure: (failure) => onFailureCallback.call(),
);
} catch (e) {
logError('DeepLinksManager::_autoSignInViaDeepLink:Exception = $e');
logWarning('DeepLinksManager::_autoSignInViaDeepLink:Exception = $e');
onFailureCallback.call();
}
}
+3 -3
View File
@@ -33,7 +33,7 @@ extension ListCapabilityIdentifierExtension on List<CapabilityIdentifier> {
requireCapability(session, accountId, this);
return true;
} catch (error) {
logError('ListCapabilityIdentifierExtension::isSupported(): $error');
logWarning('ListCapabilityIdentifierExtension::isSupported(): $error');
return false;
}
}
@@ -49,7 +49,7 @@ extension CapabilityIdentifierExtension on CapabilityIdentifier {
requireCapability(session, accountId, [this]);
return true;
} catch (error) {
logError('CapabilityIdentifierExtension::isSupported(): $error');
logWarning('CapabilityIdentifierExtension::isSupported(): $error');
return false;
}
}
@@ -63,7 +63,7 @@ extension CapabilityIdentifierSetExtension on Set<CapabilityIdentifier> {
add(CapabilityIdentifier.jmapTeamMailboxes);
return this;
} catch (error) {
logError('CapabilityIdentifierExtension::toCapabilitiesSupportTeamMailboxes(): $error');
logWarning('CapabilityIdentifierSetExtension::toCapabilitiesSupportTeamMailboxes(): $error');
return this;
}
}
@@ -5,7 +5,11 @@ class CacheExceptionThrower extends ExceptionThrower {
@override
throwException(dynamic error, dynamic stackTrace) {
logError('CacheExceptionThrower::throwException():error: $error | stackTrace: $stackTrace');
logError(
'CacheExceptionThrower::throwException():error: $error',
exception: error,
stackTrace: stackTrace,
);
throw error;
}
}
@@ -17,10 +17,14 @@ class RemoteExceptionThrower extends ExceptionThrower {
@override
throwException(dynamic error, dynamic stackTrace) {
logError('RemoteExceptionThrower::throwException():error: $error | stackTrace: $stackTrace');
logError(
'RemoteExceptionThrower::throwException():error: $error | stackTrace: $stackTrace',
exception: error,
stackTrace: stackTrace,
);
final networkConnectionController = getBinding<NetworkConnectionController>();
if (networkConnectionController?.isNetworkConnectionAvailable() == false) {
logError('RemoteExceptionThrower::throwException():isNetworkConnectionAvailable');
logWarning('RemoteExceptionThrower::throwException():isNetworkConnectionAvailable');
throw const NoNetworkError();
} else {
handleDioError(error);
@@ -29,7 +33,7 @@ class RemoteExceptionThrower extends ExceptionThrower {
void handleDioError(dynamic error) {
if (error is DioError) {
logError(
logWarning(
'RemoteExceptionThrower::throwException():type: ${error.type} | response: ${error.response} | error: ${error.error}',
);
@@ -10,11 +10,15 @@ import 'package:tmail_ui_user/main/routes/route_navigation.dart';
class SendEmailExceptionThrower extends RemoteExceptionThrower {
@override
FutureOr<void> throwException(error, stackTrace) async {
log('SendEmailExceptionThrower::throwException(): $error | stackTrace: $stackTrace');
logError(
'SendEmailExceptionThrower::throwException():error: $error | stackTrace: $stackTrace',
exception: error,
stackTrace: stackTrace,
);
final networkConnectionController = getBinding<NetworkConnectionController>();
final realtimeNetworkConnectionStatus = await networkConnectionController?.hasInternetConnection();
if (realtimeNetworkConnectionStatus == false) {
logError('SendEmailExceptionThrower::throwException(): No realtime network connection');
logWarning('SendEmailExceptionThrower::throwException(): No realtime network connection');
throw const NoNetworkError();
} else {
handleDioError(error);
@@ -47,7 +47,7 @@ class LocalizationService extends Translations {
return defaultLocale;
} catch (e) {
logError('LocalizationService::getInitialLocale:Exception is $e');
logWarning('LocalizationService::getInitialLocale:Exception is $e');
return defaultLocale;
}
}
@@ -57,7 +57,7 @@ class LocalizationService extends Translations {
final languageCacheManager = getBinding<LanguageCacheManager>();
return languageCacheManager?.getStoredLanguage();
} catch (e) {
logError('LocalizationService::getCachedLocale: Exception: $e');
logWarning('LocalizationService::getCachedLocale: Exception: $e');
return null;
}
}
@@ -92,7 +92,7 @@ class LocalizationService extends Translations {
_useDefaultLocale();
} catch (e) {
logError('LocalizationService::initializeAppLanguage: Exception: $e');
logWarning('LocalizationService::initializeAppLanguage: Exception: $e');
_useDefaultLocale();
}
}
+1 -1
View File
@@ -20,7 +20,7 @@ class AppUtils {
try {
await loadFcmConfigFileToEnv(currentMapEnvData: mapEnvData);
} catch (e) {
logError('AppUtils::loadEnvFile:loadFcmConfigFileToEnv: Exception = $e');
logWarning('AppUtils::loadEnvFile:loadFcmConfigFileToEnv: Exception = $e');
await dotenv.load(fileName: AppConfig.envFileName);
}
}
+1 -1
View File
@@ -17,7 +17,7 @@ class AssetPreloader {
HtmlEditorUtils.loadAsset(HtmlEditorConstants.summernoteFontTTFAssetPath),
]);
} catch (e) {
logError('AssetPreloader::preloadHtmlEditorAssets:Exception = $e');
logWarning('AssetPreloader::preloadHtmlEditorAssets:Exception = $e');
}
}
}
+1 -1
View File
@@ -14,7 +14,7 @@ class CozyIntegration {
await cozyConfig.injectCozyScript(AppConfig.cozyExternalBridgeVersion);
await cozyConfig.initialize();
} catch (e) {
logError('CozyIntegration::integrateCozy:Exception = $e');
logWarning('CozyIntegration::integrateCozy:Exception = $e');
}
}
}
+2 -2
View File
@@ -38,7 +38,7 @@ class IOSNotificationManager {
}
});
} catch (e) {
logError('IOSNotificationManager::listenClickNotification:Exception = $e');
logWarning('IOSNotificationManager::listenClickNotification:Exception = $e');
}
}
@@ -53,7 +53,7 @@ class IOSNotificationManager {
return null;
}
} catch (e) {
logError('IOSNotificationManager::getCurrentEmailIdInNotificationClick:Exception = $e');
logWarning('IOSNotificationManager::getCurrentEmailIdInNotificationClick:Exception = $e');
return null;
}
}
+13 -13
View File
@@ -50,7 +50,7 @@ class IOSSharingManager {
final keychainSharingStored = await getKeychainSharingSession(accountId);
return keychainSharingStored?.emailDeliveryState;
} catch (e) {
logError('IOSSharingManager::_getEmailDeliveryStateFromKeychain: Exception: $e');
logWarning('IOSSharingManager::getEmailDeliveryStateFromKeychain: Exception: $e');
return null;
}
}
@@ -59,8 +59,8 @@ class IOSSharingManager {
log('IOSSharingManager::saveKeyChainSharingSession: START');
try {
if (!_validateToSaveKeychain(personalAccount)) {
logError('IOSSharingManager::saveKeyChainSharingSession: AccountId | Username | ApiUrl is NULL');
return Future.value(null);
logWarning('IOSSharingManager::saveKeyChainSharingSession: AccountId | Username | ApiUrl is NULL');
return;
}
TokenOIDC? tokenOIDC;
@@ -107,7 +107,7 @@ class IOSSharingManager {
log('IOSSharingManager::_saveKeyChainSharingSession: COMPLETED');
} catch (e) {
logError('IOSSharingManager::_saveKeyChainSharingSession: Exception: $e');
logWarning('IOSSharingManager::_saveKeyChainSharingSession: Exception: $e');
}
}
@@ -119,7 +119,7 @@ class IOSSharingManager {
}
return null;
} catch (e) {
logError('IOSSharingManager::getKeychainSharingSession: Exception: $e');
logWarning('IOSSharingManager::getKeychainSharingSession: Exception: $e');
return null;
}
}
@@ -128,7 +128,7 @@ class IOSSharingManager {
try {
return await _tokenOidcCacheManager.getTokenOidc(tokeHashId);
} catch (e) {
logError('IOSSharingManager::_getTokenOidc:Exception: $e');
logWarning('IOSSharingManager::_getTokenOidc:Exception: $e');
return null;
}
}
@@ -138,7 +138,7 @@ class IOSSharingManager {
final credentialInfo = await _authenticationInfoCacheManager.getAuthenticationInfoStored();
return base64Encode(utf8.encode('${credentialInfo.username}:${credentialInfo.password}'));
} catch (e) {
logError('IOSSharingManager::_getCredentialAuthentication:Exception: $e');
logWarning('IOSSharingManager::_getCredentialAuthentication:Exception: $e');
return null;
}
}
@@ -150,7 +150,7 @@ class IOSSharingManager {
try {
return await getEmailDeliveryStateFromKeychain(accountId);
} catch (e) {
logError('IOSSharingManager::_getEmailDeliveryState:Exception: $e');
logWarning('IOSSharingManager::_getEmailDeliveryState:Exception: $e');
return null;
}
}
@@ -168,7 +168,7 @@ class IOSSharingManager {
log('IOSSharingManager::_getEmailState:emailState: $emailState');
return emailState?.value;
} catch (e) {
logError('IOSSharingManager::_getEmailState:Exception: $e');
logWarning('IOSSharingManager::_getEmailState:Exception: $e');
return null;
}
}
@@ -183,7 +183,7 @@ class IOSSharingManager {
isTWP: oidcConfig.isTWP,
);
} catch (e) {
logError('IOSSharingManager::_getTokenEndpointAndScopes:Exception: $e');
logWarning('IOSSharingManager::_getTokenEndpointScopesAndIsTWP:Exception: $e');
return null;
}
}
@@ -202,7 +202,7 @@ class IOSSharingManager {
final keychainSharingStored = await getKeychainSharingSession(accountId);
return keychainSharingStored?.mailboxIdsBlockNotification?.isNotEmpty == true;
} catch (e) {
logError('IOSSharingManager::getMailboxIdsBlockNotificationInKeyChain:Exception = $e');
logWarning('IOSSharingManager::isExistMailboxIdsBlockNotificationInKeyChain:Exception = $e');
return false;
}
}
@@ -219,7 +219,7 @@ class IOSSharingManager {
final newKeychain = keychainSharingStored.updating(mailboxIdsBlockNotification: mailboxIds);
await _keychainSharingManager.save(newKeychain);
} catch (e) {
logError('IOSSharingManager::updateMailboxIdsBlockNotificationInKeyChain: Exception = $e');
logWarning('IOSSharingManager::updateMailboxIdsBlockNotificationInKeyChain: Exception = $e');
}
}
@@ -236,7 +236,7 @@ class IOSSharingManager {
log('IOSSharingManager::_getMailboxIdsBlockNotification(): CACHE_MAILBOX_LIST = $listMailboxIdBlockNotification');
return listMailboxIdBlockNotification;
} catch (e) {
logError('IOSSharingManager::_getMailboxIdsBlockNotification:Exception: $e');
logWarning('IOSSharingManager::_getMailboxIdsBlockNotification:Exception: $e');
return null;
}
}
+3 -3
View File
@@ -143,7 +143,7 @@ class ToastManager {
final context = currentContext;
final overlayContext = currentOverlayContext;
if (context == null || overlayContext == null) {
logError('ToastManager::showMessageFailure: Context or OverlayContext is null');
logWarning('ToastManager::showMessageFailure: Context or OverlayContext is null');
return;
}
@@ -231,7 +231,7 @@ class ToastManager {
final context = currentContext;
final overlayContext = currentOverlayContext;
if (context == null || overlayContext == null) {
logError('ToastManager::showMessageSuccess: Context or OverlayContext is null');
logWarning('ToastManager::showMessageSuccess: Context or OverlayContext is null');
return;
}
@@ -273,7 +273,7 @@ class ToastManager {
final context = currentContext;
final overlayContext = currentOverlayContext;
if (context == null || overlayContext == null) {
logError('$runtimeType::showMessageSuccessWithAction: Context or OverlayContext is null');
logWarning('$runtimeType::showMessageSuccessWithAction: Context or OverlayContext is null');
return;
}